]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/python/resources/package.rb
imagery: fix proto headers
[chef.git] / cookbooks / python / resources / package.rb
index 0679e87e34f7b75030610c1d79be94a7e6a17643..c838690afebe9e21d4284b0a3e5ca3bdf8da9df4 100644 (file)
@@ -17,6 +17,8 @@
 # limitations under the License.
 #
 
+unified_mode true
+
 default_action :install
 
 property :package_name, :kind_of => String, :name_property => true
@@ -38,6 +40,20 @@ action :install do
   end
 end
 
+action :upgrade do
+  if new_resource.version.nil?
+    execute "pip-upgrade-#{new_resource.package_name}" do
+      command "#{pip_command} install --upgrade #{new_resource.package_name}"
+      only_if "#{pip_command} list --outdated | fgrep -q #{new_resource.package_name}"
+    end
+  else
+    execute "pip-upgrade-#{new_resource.package_name}" do
+      command "#{pip_command} install --upgrade #{new_resource.package_name}==#{new_resource.version}"
+      not_if "#{pip_command} show #{new_resource.package_name} | fgrep -q #{new_resource.version}"
+    end
+  end
+end
+
 action :remove do
   execute "pip-uninstall-#{new_resource.package_name}" do
     command "#{pip_command} uninstall #{new_resource.package_name}"