arguments = dict(
cidr=ValueArgument('explicitly set cidr', '--with-cidr'),
gateway=ValueArgument('explicitly set gateway', '--with-gateway'),
- dhcp=ValueArgument('explicitly set dhcp', '--with-dhcp'),
+ dhcp=FlagArgument('Use dhcp (default: off)', '--with-dhcp'),
type=ValueArgument('explicitly set type', '--with-type')
)
def create_network(
self, name,
- cidr=None, gateway=None, type=None, dhcp=None):
+ cidr=None, gateway=None, type=None, dhcp=False):
"""
:param name: (str)
:param type: (str)
- :param dhcp: (str)
+ :param dhcp: (bool)
:returns: (dict) network detailed info
"""
net['gateway'] = gateway
if type:
net['type'] = type
- if dhcp:
- net['dhcp'] = dhcp
+ net['dhcp'] = True if dhcp else False
req = dict(network=net)
r = self.networks_post(json_data=req, success=202)
return r.json['network']