Skip to content

Commit

Permalink
Network ID is only checked if neutron is available
Browse files Browse the repository at this point in the history
[#128759741](https://www.pivotaltracker.com/story/show/128759741)

Signed-off-by: Beyhan Veli <beyhan.veli@sap.com>
  • Loading branch information
loewenstein-sap authored and beyhan committed Aug 23, 2016
1 parent 3454c64 commit 1a7d624
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/bosh_openstack_cpi/lib/cloud/openstack/openstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,14 @@ def network
end
rescue Excon::Errors::SocketError => e
cloud_error(socket_error_msg + "#{e.message}")
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError => e
rescue Bosh::Common::RetryCountExceeded, Excon::Errors::ClientError, Excon::Errors::ServerError, Fog::Errors::NotFound => e
cloud_error("Unable to connect to the OpenStack Network Service API: #{e.message}. Check task debug log for details.")
end
end

@network
end

def metadata

end


private

def openstack_params(options)
Expand Down
11 changes: 11 additions & 0 deletions src/bosh_openstack_cpi/spec/unit/openstack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
end
end

context 'when the service is not available' do
describe 'Network' do
it 'raises a CloudError exception if cannot connect to the service API' do
allow(Fog::Network).to receive(:new).and_raise(Fog::Errors::NotFound, 'Not found message')
expect {
Bosh::OpenStackCloud::Openstack.new(openstack_options).network
}.to raise_error(Bosh::Clouds::CloudError,
'Unable to connect to the OpenStack Network Service API: Not found message. Check task debug log for details.')
end
end
end

[ {clazz: Fog::Compute, name: 'Compute', method_name: :compute},
{clazz: Fog::Image::OpenStack::V2, name: 'Image', method_name: :image},
Expand Down

0 comments on commit 1a7d624

Please sign in to comment.