summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-06-13 19:25:33 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-06-13 19:25:33 +0530
commit303ab20e892e4ef0b511023f180de62e3504a40c (patch)
treeb346054eb0c91e5a347e4dcb5d7ec70586a7872b
parent2cbcad439c29cde34762fffcf6990c9825066138 (diff)
downloadchef-303ab20e892e4ef0b511023f180de62e3504a40c.tar.gz
update to pass sensitive as option
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/provider/package/windows.rb1
-rw-r--r--lib/chef/provider/package/windows/exe.rb36
-rw-r--r--lib/chef/resource/windows_package.rb5
3 files changed, 13 insertions, 29 deletions
diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb
index 8958bff068..abafbce011 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -228,6 +228,7 @@ class Chef
r.timeout(new_resource.timeout)
r.returns(new_resource.returns)
r.options(new_resource.options)
+ r.sensitive(new_resource.sensitive)
end
end
diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb
index a32c207596..e43cd02b08 100644
--- a/lib/chef/provider/package/windows/exe.rb
+++ b/lib/chef/provider/package/windows/exe.rb
@@ -55,27 +55,17 @@ class Chef
def install_package
logger.trace("#{new_resource} installing #{new_resource.installer_type} package '#{new_resource.source}'")
- begin
- shell_out!(
- [
- "start",
- "\"\"",
- "/wait",
- "\"#{new_resource.source}\"",
- unattended_flags,
- expand_options(new_resource.options),
- "& exit %%%%ERRORLEVEL%%%%",
- ].join(" "), timeout: new_resource.timeout, returns: new_resource.returns
- )
- rescue Mixlib::ShellOut::ShellCommandFailed
- if sensitive?
- ex = Mixlib::ShellOut::ShellCommandFailed.new("Command execution failed. STDOUT/STDERR suppressed for sensitive resource")
- raise ex
- else
- raise
- end
- end
- logger.info("#{new_resource} ran successfully")
+ shell_out!(
+ [
+ "start",
+ "\"\"",
+ "/wait",
+ "\"#{new_resource.source}\"",
+ unattended_flags,
+ expand_options(new_resource.options),
+ "& exit %%%%ERRORLEVEL%%%%",
+ ].join(" "), timeout: new_resource.timeout, returns: new_resource.returns, sensitive: new_resource.sensitive
+ )
end
def remove_package
@@ -89,10 +79,6 @@ class Chef
private
- def sensitive?
- !!new_resource.sensitive
- end
-
def uninstall_command(uninstall_string)
uninstall_string = "\"#{uninstall_string}\"" if ::File.exist?(uninstall_string)
uninstall_string = [
diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb
index fb0f2c26ae..49496aed9a 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -42,10 +42,7 @@ class Chef
end
# windows can't take array options yet
- property :options, String, sensitive: true
-
- # lazy used to set default value of sensitive to true if options is set
- property :sensitive, [ TrueClass, FalseClass ], default: lazy { |r| r.options ? true : false }
+ property :options, String
# Unique to this resource
property :installer_type, Symbol