cli.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:kcli 作者: karmab 项目源码 文件源码
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 ')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号