summaryrefslogtreecommitdiff
path: root/lib/chef/resource/windows_package.rb
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2015-12-15 12:13:31 -0800
committerMatt Wrock <matt@mattwrock.com>2015-12-15 12:28:53 -0800
commit09df8eea8bdbca4b7f1f0db43033d8d473860131 (patch)
treefc01ea00bfc3a6467a59f6ed1e67a6f9ae7496fe /lib/chef/resource/windows_package.rb
parentb743fcdbd172862386d172b42bbbc31cfe2f4239 (diff)
downloadchef-09df8eea8bdbca4b7f1f0db43033d8d473860131.tar.gz
non msi packages must explicitly provide a source attribute on install
Diffstat (limited to 'lib/chef/resource/windows_package.rb')
-rw-r--r--lib/chef/resource/windows_package.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb
index 4965f3f117..7f70f876d0 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -32,16 +32,20 @@ class Chef
allowed_actions :install, :remove
+ def initialize(name, run_context=nil)
+ super
+ @source ||= source(@package_name) if @package_name.downcase.end_with?('.msi')
+ end
+
# Unique to this resource
property :installer_type, Symbol
property :timeout, [ String, Integer ], default: 600
# In the past we accepted return code 127 for an unknown reason and 42 because of a bug
property :returns, [ String, Integer, Array ], default: [ 0 ], desired_state: false
- property :source, String, name_property: true,
+ property :source, String,
coerce: proc { |s| uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false) }
property :checksum, String, desired_state: false
property :remote_file_attributes, Hash, desired_state: false
-
end
end
end