diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-15 15:10:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-15 15:10:00 -0800 |
commit | 7b39f6dbfe18653123dbc9459d145dcf7f752479 (patch) | |
tree | d5eb18c4a528cbf9c7aba1eab248cfd8c917fe15 /lib/chef/provider/package | |
parent | ee049ed97120993d1ef1ff99e697906e7a541eda (diff) | |
download | chef-7b39f6dbfe18653123dbc9459d145dcf7f752479.tar.gz |
fix FIXME in define_resource_requirements
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/package')
-rw-r--r-- | lib/chef/provider/package/dnf.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb index c8ab82acdd..f48b1341a6 100644 --- a/lib/chef/provider/package/dnf.rb +++ b/lib/chef/provider/package/dnf.rb @@ -63,10 +63,12 @@ class Chef end def define_resource_requirements - # FIXME: - #unless ::File.exist?(new_resource.source) - # raise Chef::Exceptions::Package, "Package #{new_resource.name} not found: #{new_resource.source}" - #end + requirements.assert(:install, :upgrade, :remove, :purge) do |a| + a.assertion { !new_resource.source || ::File.exist?(new_resource.source) } + a.failure_message Chef::Exceptions::Package, "Package #{new_resource.package_name} not found: #{new_resource.source}" + a.whyrun "assuming #{new_resource.source} would have previously been created" + end + super end @@ -119,6 +121,8 @@ class Chef def resolve_source_to_version_obj shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| + # this is another case of committing the sin of doing some lightweight mangling of RPM versions in ruby -- but the output of the rpm command + # does not match what the dnf library accepts. case line when /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/ return Version.new($1, "#{$2 == "(none)" ? "0" : $2}:#{$3}-#{$4}", $5) |