summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-06-13 19:25:33 +0530
committerTim Smith <tsmith@chef.io>2018-09-25 11:37:11 -0700
commit545fcdcc2bb7fd03a7ce2a377e840fc72ec96bdb (patch)
tree50d890e99dcc52d49e16cbab95bd415ed74f8eb4
parent98dcb47109785f2d79e994701a8ebe791779d37e (diff)
downloadchef-545fcdcc2bb7fd03a7ce2a377e840fc72ec96bdb.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 1d160095be..a35aa85c16 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -229,6 +229,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 8197ffa5cd..dfa1bbe2a9 100644
--- a/lib/chef/provider/package/windows/exe.rb
+++ b/lib/chef/provider/package/windows/exe.rb
@@ -53,27 +53,17 @@ class Chef
def install_package
Chef::Log.debug("#{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
- Chef::Log.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
@@ -87,10 +77,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 e7cd4b739f..d373e1f19c 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -40,10 +40,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