X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/b0d9abfbd0d3b78db57f09a8976b10a446542a99..ae4d13c8ba1b86d2f94bcdec799d0db052425333:/cookbooks/python/resources/package.rb diff --git a/cookbooks/python/resources/package.rb b/cookbooks/python/resources/package.rb index d6431c87d..7dddd17af 100644 --- a/cookbooks/python/resources/package.rb +++ b/cookbooks/python/resources/package.rb @@ -24,13 +24,13 @@ property :version, :kind_of => String property :python_version, :kind_of => String action :install do - if version.nil? - execute "pip-install-#{name}" do + if new_resource.version.nil? + execute "pip-install-#{new_resource.package_name}" do command "#{pip_command} install #{new_resource.package_name}" not_if "#{pip_command} show #{new_resource.package_name}" end else - execute "pip-install-#{name}" do + execute "pip-install-#{new_resource.package_name}" do command "#{pip_command} install #{new_resource.package_name}==#{new_resource.version}" not_if "#{pip_command} show #{new_resource.package_name} | fgrep -q #{new_resource.version}" end @@ -38,12 +38,14 @@ action :install do end action :remove do - execute "pip-uninstall-#{name}" do + execute "pip-uninstall-#{new_resource.package_name}" do command "#{pip_command} uninstall #{new_resource.package_name}" only_if "#{pip_command} show #{new_resource.package_name}" end end -def pip_command - "pip#{python_version}" +action_class do + def pip_command + "pip#{new_resource.python_version}" + end end