diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-22 11:50:19 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-24 07:50:22 -0700 |
commit | b9588e857b60bec1950bcd1ef2f2bb97f4fe60fd (patch) | |
tree | 56a8d6a610355905d40bd02896d530f1fdf5c4a9 | |
parent | 5cae811a9684d2994c444cefd0e0c80e5db38247 (diff) | |
download | chef-b9588e857b60bec1950bcd1ef2f2bb97f4fe60fd.tar.gz |
Merge pull request #2281 from opscode/jdmundrawala/lcm-renamesjdmundrawala/11-lcm-renames
Renamed output_has_dsc_module_failure to dsc_module_import_failure
-rw-r--r-- | lib/chef/util/dsc/local_configuration_manager.rb | 4 | ||||
-rw-r--r-- | spec/unit/util/dsc/local_configuration_manager_spec.rb | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb index 7395dd5bbf..4d49c8dcff 100644 --- a/lib/chef/util/dsc/local_configuration_manager.rb +++ b/lib/chef/util/dsc/local_configuration_manager.rb @@ -82,14 +82,14 @@ EOH if what_if_exception_output.gsub(/\s+/, ' ') =~ /A parameter cannot be found that matches parameter name 'Whatif'/i # LCM returns an error if any of the resources do not support the opptional What-If Chef::Log::warn("Received error while testing configuration due to resource not supporting 'WhatIf'") - elsif output_has_dsc_module_failure?(what_if_exception_output) + elsif dsc_module_import_failure?(what_if_exception_output) Chef::Log::warn("Received error while testing configuration due to a module for an imported resource possibly not being fully installed:\n#{what_if_exception_output.gsub(/\s+/, ' ')}") else Chef::Log::warn("Received error while testing configuration:\n#{what_if_exception_output.gsub(/\s+/, ' ')}") end end - def output_has_dsc_module_failure?(what_if_output) + def dsc_module_import_failure?(what_if_output) !! (what_if_output =~ /\sCimException/ && what_if_output =~ /ProviderOperationExecutionFailure/ && what_if_output =~ /\smodule\s+is\s+installed/) diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb index c9a63bf816..f630ac89d8 100644 --- a/spec/unit/util/dsc/local_configuration_manager_spec.rb +++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb @@ -92,7 +92,7 @@ EOH it 'should log a warning if the message is formatted as expected when a resource import failure occurs' do expect(Chef::Log).to receive(:warn) - expect(lcm).to receive(:output_has_dsc_module_failure?).and_call_original + expect(lcm).to receive(:dsc_module_import_failure?).and_call_original test_configuration_result = nil expect {test_configuration_result = lcm.test_configuration('config')}.not_to raise_error end @@ -112,22 +112,22 @@ EOH it 'should log a warning' do expect(Chef::Log).to receive(:warn) - expect(lcm).to receive(:output_has_dsc_module_failure?).and_call_original + expect(lcm).to receive(:dsc_module_import_failure?).and_call_original expect {lcm.test_configuration('config')}.not_to raise_error end end end it 'should identify a correctly formatted error message as a resource import failure' do - expect(lcm.send(:output_has_dsc_module_failure?, dsc_resource_import_failure_output)).to be(true) + expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true) end it 'should not identify an incorrectly formatted error message as a resource import failure' do - expect(lcm.send(:output_has_dsc_module_failure?, dsc_resource_import_failure_output.gsub('module', 'gibberish'))).to be(false) + expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('module', 'gibberish'))).to be(false) end it 'should not identify a message without a CimException reference as a resource import failure' do - expect(lcm.send(:output_has_dsc_module_failure?, dsc_resource_import_failure_output.gsub('CimException', 'ArgumentException'))).to be(false) + expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('CimException', 'ArgumentException'))).to be(false) end end end |