Fix bugs around dhcp4_flag

This commit is contained in:
Joshua Boniface 2020-01-06 15:37:53 -05:00
parent 3816da6be6
commit 096a740c4f
3 changed files with 7 additions and 7 deletions

View File

@ -733,6 +733,8 @@ def net_add(vni, description, nettype, domain, name_servers,
"""
Add a virtual client network to the PVC cluster.
"""
if dhcp4_flag:
dhcp4_flag = bool(strtobool(dhcp4_flag))
zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_network.add_network(zk_conn, vni, description, nettype, domain, name_servers,
ip4_network, ip4_gateway, ip6_network, ip6_gateway,
@ -756,6 +758,8 @@ def net_modify(vni, description, domain, name_servers,
"""
Modify a virtual client network in the PVC cluster.
"""
if dhcp4_flag:
dhcp4_flag = bool(strtobool(dhcp4_flag))
zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_network.modify_network(zk_conn, vni, description, domain, name_servers,
ip4_network, ip4_gateway, ip6_network, ip6_gateway,

View File

@ -1608,7 +1608,7 @@ class API_Network_Root(Resource):
reqargs.get('ip4_gateway', None),
reqargs.get('ip6_network', None),
reqargs.get('ip6_gateway', None),
reqargs.get('dhcp4_flag', None),
reqargs.get('dhcp4', None),
reqargs.get('dhcp4_start', None),
reqargs.get('dhcp4_end', None),
)
@ -1732,7 +1732,7 @@ class API_Network_Element(Resource):
reqargs.get('ip4_gateway', None),
reqargs.get('ip6_network', None),
reqargs.get('ip6_gateway', None),
reqargs.get('dhcp4_flag', None),
reqargs.get('dhcp4', None),
reqargs.get('dhcp4_start', None),
reqargs.get('dhcp4_end', None),
)
@ -1828,7 +1828,7 @@ class API_Network_Element(Resource):
reqargs.get('ip4_gateway', None),
reqargs.get('ip6_network', None),
reqargs.get('ip6_gateway', None),
reqargs.get('dhcp4_flag', None),
reqargs.get('dhcp4', None),
reqargs.get('dhcp4_start', None),
reqargs.get('dhcp4_end', None),
)

View File

@ -253,10 +253,6 @@ def add_network(zk_conn, vni, description, nettype,
if nettype == 'managed' and not domain:
domain = '{}.local'.format(description)
# Make sure the DHCP4 flag is always boolean
if dhcp4_flag is None:
dhcp4_flag = False
# Add the new network to Zookeeper
zkhandler.writedata(zk_conn, {
'/networks/{}'.format(vni): description,