diff options
author | Alexey Karpik <alexey.karpik@rightscale.com> | 2015-03-20 10:15:51 +0300 |
---|---|---|
committer | Alexey Karpik <alexey.karpik@rightscale.com> | 2015-03-20 10:21:46 +0300 |
commit | 8b316e29c6df936f93ca579692b402b76d63e955 (patch) | |
tree | 9397851dabeb03dc24c86b08dad5a03bc689f90c | |
parent | 08baaff57e3f6af57b88f18d22a68dc01c651a2e (diff) | |
download | ohai-8b316e29c6df936f93ca579692b402b76d63e955.tar.gz |
Iterate on review. We do not create softlayer node, if we get error on request to SoftLayer API
-rw-r--r-- | lib/ohai/mixin/softlayer_metadata.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/softlayer_metadata_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/softlayer_spec.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/ohai/mixin/softlayer_metadata.rb b/lib/ohai/mixin/softlayer_metadata.rb index f44b27c9..a7ee8511 100644 --- a/lib/ohai/mixin/softlayer_metadata.rb +++ b/lib/ohai/mixin/softlayer_metadata.rb @@ -59,6 +59,6 @@ module ::Ohai::Mixin::SoftlayerMetadata end rescue => e ::Ohai::Log.error("Unable to fetch softlayer metadata from #{u}: #{e.class}: #{e.message}") - nil + raise e end end diff --git a/spec/unit/mixin/softlayer_metadata_spec.rb b/spec/unit/mixin/softlayer_metadata_spec.rb index 492f23fb..e222591e 100644 --- a/spec/unit/mixin/softlayer_metadata_spec.rb +++ b/spec/unit/mixin/softlayer_metadata_spec.rb @@ -44,7 +44,7 @@ describe ::Ohai::Mixin::SoftlayerMetadata do allow(::Net::HTTP).to receive(:new).with('api.service.softlayer.com', 443).and_return(http_mock) expect(::Ohai::Log).to receive(:error).at_least(:once) - expect(mixin.fetch_metadata).not_to be_nil + expect{mixin.fetch_metadata}.to raise_error(StandardError) end it "query api service" do diff --git a/spec/unit/plugins/softlayer_spec.rb b/spec/unit/plugins/softlayer_spec.rb index 1534125d..0d0c45ae 100644 --- a/spec/unit/plugins/softlayer_spec.rb +++ b/spec/unit/plugins/softlayer_spec.rb @@ -30,7 +30,7 @@ describe Ohai::System, 'plugin softlayer' do it "do not create node if fetch_metadata raise an error" do allow(plugin).to receive(:hint?).with('softlayer').and_return(false) - allow(plugin).to receive(:fetch_metadata).and_raise(Exception.new("TEST")) + allow(plugin).to receive(:fetch_metadata).and_raise(StandardError.new("TEST")) plugin.run expect(plugin[:softlayer]).to be_nil end |