Fix bad entry in network add

This commit is contained in:
Joshua Boniface 2021-06-13 18:20:40 -04:00
parent 647bce2a22
commit 8269930d40
1 changed files with 6 additions and 3 deletions

View File

@ -255,14 +255,14 @@ def add_network(zkhandler, vni, description, nettype,
domain = '{}.local'.format(description) domain = '{}.local'.format(description)
# Add the new network to Zookeeper # Add the new network to Zookeeper
zkhandler.write([ result = zkhandler.write([
(('network', vni), description), (('network', vni), description),
(('network.type', vni), nettype), (('network.type', vni), nettype),
(('network.domain', vni), domain), (('network.domain', vni), domain),
(('network.nameservers', vni), name_servers), (('network.nameservers', vni), name_servers),
(('network.ip6.network', vni), ip6_network), (('network.ip6.network', vni), ip6_network),
(('network.ip6.gateway', vni), ip6_gateway), (('network.ip6.gateway', vni), ip6_gateway),
(('network.ip4.dhcp', vni), dhcp6_flag), (('network.ip6.dhcp', vni), dhcp6_flag),
(('network.ip4.network', vni), ip4_network), (('network.ip4.network', vni), ip4_network),
(('network.ip4.gateway', vni), ip4_gateway), (('network.ip4.gateway', vni), ip4_gateway),
(('network.ip4.dhcp', vni), dhcp4_flag), (('network.ip4.dhcp', vni), dhcp4_flag),
@ -275,7 +275,10 @@ def add_network(zkhandler, vni, description, nettype,
(('network.rule.out', vni), '') (('network.rule.out', vni), '')
]) ])
if result:
return True, 'Network "{}" added successfully!'.format(description) return True, 'Network "{}" added successfully!'.format(description)
else:
return False, 'ERROR: Failed to add network.'
def modify_network(zkhandler, vni, description=None, domain=None, name_servers=None, def modify_network(zkhandler, vni, description=None, domain=None, name_servers=None,