def network(args):
"""Create/Delete/List Network"""
name = args.name
delete = args.delete
isolated = args.isolated
cidr = args.cidr
nodhcp = args.nodhcp
domain = args.domain
pxe = args.pxe
global config
k = config.k
if name is None:
common.pprint("Missing Network", color='red')
os._exit(1)
if delete:
result = k.delete_network(name=name)
common.handle_response(result, name, element='Network ', action='deleted')
else:
if isolated:
nat = False
else:
nat = True
dhcp = not nodhcp
result = k.create_network(name=name, cidr=cidr, dhcp=dhcp, nat=nat, domain=domain, pxe=pxe)
common.handle_response(result, name, element='Network ')
评论列表
文章目录