summaryrefslogtreecommitdiff
path: root/lib/chef/resource/cab_package.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-12-15 17:58:35 -0800
committerTim Smith <tsmith@chef.io>2017-12-15 17:58:35 -0800
commit1016e4e87d02d309b96bed99e7fb006a3aa958f4 (patch)
tree50c6e07729c5ebea1dacf64065bf4e8c0136f95d /lib/chef/resource/cab_package.rb
parent10252cc8f4f855d5de65efb645583f89bf8771f2 (diff)
downloadchef-1016e4e87d02d309b96bed99e7fb006a3aa958f4.tar.gz
Fix bugs in handling 'source' in msu_package and cab_package
The two issues fixed here: 1) cab_package did not require source, but didn't set it from the resource name so cab_package 'xyz.cab' would just fail since source was nil 2) msu_package would coerce the resource name and not package_name so if you overwrote the package name you would also have to set the source, although you wouldn't realize that until it failed oddly So the solution here is to set the source value to package_name by default and that gets coerced into a path as was previously done. This adds tests for this behavior and the coerce behavior itself to both resources. This fixes issue #6674 Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/cab_package.rb')
-rw-r--r--lib/chef/resource/cab_package.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/resource/cab_package.rb b/lib/chef/resource/cab_package.rb
index 73e639814d..fcf3f02b86 100644
--- a/lib/chef/resource/cab_package.rb
+++ b/lib/chef/resource/cab_package.rb
@@ -34,7 +34,8 @@ class Chef
unless s.nil?
uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
end
- end)
+ end),
+ default: lazy { |r| r.package_name }
end
end
end