Update network types
This commit resolves similar issues with both the nova_floating type as well as the nova_network type where they could not detect if networks already existed.
This commit is contained in:
parent
d45ac457c2
commit
067fdb49c7
|
@ -6,8 +6,10 @@ Puppet::Type.type(:nova_floating).provide(:nova_manage) do
|
|||
|
||||
def exists?
|
||||
begin
|
||||
# TODO this assumes that the CIDR is 24
|
||||
# this may be good for an approximation, but it needs to be fixed eventually
|
||||
prefix=resource[:network].sub(/(^[0-9]*\.[0-9]*\.[0-9]*\.).*/, '\1')
|
||||
return false if not nova_manage("floating", "list").match(/#{prefix}/)
|
||||
return nova_manage("floating", "list").match(/#{prefix}/)
|
||||
rescue
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -27,7 +27,8 @@ Puppet::Type.type(:nova_network).provide(:nova_manage) do
|
|||
begin
|
||||
network_list = nova_manage("network", "list")
|
||||
return network_list.split("\n")[1..-1].detect do |n|
|
||||
n =~ /^(\S+)\s+(#{resource[:network]})/
|
||||
# TODO - this does not take the CIDR into accont. Does it matter?
|
||||
n =~ /^(\S+)\s+(#{resource[:network].split('/').first})/
|
||||
end
|
||||
rescue
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue