Add failure for missing interface

This will fail with a useful error message in case the interface we are
trying to get an address for does not exist. Currently the user will
only get an unspecific "undefined method [] for nil" error.

Change-Id: I392564324fb5203df3ce390aff990ff976058320
This commit is contained in:
Jens Rosenboom 2015-07-16 16:53:40 +02:00
parent f6ab635369
commit fe58d5394e
1 changed files with 1 additions and 0 deletions

View File

@ -37,6 +37,7 @@ module ::Openstack
return '0.0.0.0'
end
end
fail "Interface #{interface} does not exist" unless nodeish['network']['interfaces'][interface]
addresses = nodeish['network']['interfaces'][interface]['addresses']
fail "Interface #{interface} has no addresses assigned" if addresses.to_a.empty?
get_address addresses, family, drop_vips