]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/python/resources/package.rb
civicrm: pivotreport extension patch now only in original repo
[chef.git] / cookbooks / python / resources / package.rb
index 0a3f491705429e99fc253bb3f63d4b181b716f62..c838690afebe9e21d4284b0a3e5ca3bdf8da9df4 100644 (file)
@@ -40,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}"