summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-08-30 22:54:59 -0700
committerAdam Edwards <adamed@opscode.com>2014-08-30 22:54:59 -0700
commit4f98c0027c59cd1faad25a3307fecec6942f9f6b (patch)
treeae830e1db34513d4825538b5806859eaa44ef191
parentf4cbb7560d007d904979e924ce1dc1e836d7d9fd (diff)
downloadchef-4f98c0027c59cd1faad25a3307fecec6942f9f6b.tar.gz
Expose exit_code for cmdlet_result and use to detect DSC resource installation problems
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb2
-rw-r--r--lib/chef/util/powershell/cmdlet_result.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index b1b0752be1..d25f144095 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -33,7 +33,7 @@ class Chef::Util::DSC
status = run_configuration_cmdlet(configuration_document)
command_output = status.return_value
unless status.succeeded?
- if status.status.exitstatus == LCM_MODULE_NOT_INSTALLED_ERROR_CODE
+ if status.exit_code == LCM_MODULE_NOT_INSTALLED_ERROR_CODE
Chef::Log::warn('Unable to test configuration because a required DSC PowerShell module may not be installed.')
command_output = ''
end
diff --git a/lib/chef/util/powershell/cmdlet_result.rb b/lib/chef/util/powershell/cmdlet_result.rb
index 390ee8cbc1..0e9ccc3523 100644
--- a/lib/chef/util/powershell/cmdlet_result.rb
+++ b/lib/chef/util/powershell/cmdlet_result.rb
@@ -38,6 +38,10 @@ class Chef::Util::Powershell
@status.stdout
end
end
+
+ def exit_code
+ @status.status.exitstatus
+ end
def succeeded?
@succeeded = @status.status.exitstatus == 0