Skip to content

Instantly share code, notes, and snippets.

@redivy
Created March 17, 2010 15:26
Show Gist options
  • Save redivy/335353 to your computer and use it in GitHub Desktop.
Save redivy/335353 to your computer and use it in GitHub Desktop.
--- lib/chef/provider/package/zypper.rb 2010-03-16 14:52:15.000000000 +0300
+++ lib/chef/provider/package/zypper.rb 2010-03-17 18:18:37.000000000 +0300
@@ -35,7 +35,8 @@
version=''
is_out_of_date=false
Chef::Log.debug("Checking zypper for #{@new_resource.package_name}")
- status = popen4("zypper info #{@new_resource.package_name}") do |pid, stdin, stdout, stderr|
+ status = popen4("zypper info #{@new_resource.package_name}",
+ :environment => {'ZYPP_READONLY_HACK' => '1'} ) do |pid, stdin, stdout, stderr|
stdout.each do |line|
case line
when /^Version: (.+)$/
@@ -79,6 +80,9 @@
raise Chef::Exceptions::Package, "zypper failed - #{status.inspect}!"
end
+ if @candidate_version == ''
+ raise Chef::Exceptions::Package, "zypper does not have a version of package #{@new_resource.package_name}"
+ end
Chef::Log.debug("zypper current resource #{@current_resource}")
@current_resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment