本文整理汇总了Python中host.Host.delete_network方法的典型用法代码示例。如果您正苦于以下问题:Python Host.delete_network方法的具体用法?Python Host.delete_network怎么用?Python Host.delete_network使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类host.Host
的用法示例。
在下文中一共展示了Host.delete_network方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: host_process_cli
# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import delete_network [as 别名]
def host_process_cli(config, auth, opt):
if opt['--delimeter'] is None:
delimeter = " "
else:
delimeter = opt['--delimeter']
if opt['--format'] is None:
o_format = "text"
else:
o_format = opt['--format']
n = Host(
hostname=config.host,
auth=auth,
o_format=o_format,
delimeter=delimeter
)
if opt['list'] is True:
n.list_hosts()
elif opt['search'] is True:
n.search(
name=opt['<name>'],
site=opt['<site>'],
)
elif opt['get'] is True:
network = opt['<network>']
n.get(network)
elif opt['fixedaddresses'] is True:
network = opt['<network>']
n.fixedaddresses(network)
elif opt['create'] is True:
name = opt['<name>']
ipv4addrs = opt['<ipv4addrs>']
mac = opt['<mac>']
n.create_host(
name,
ipv4addrs,
mac,
disable=disable,
members=members,
)
if n.api_out.has_error:
print "Unable to Create Host: %s" % network
sys.exit(2)
else:
print "Host Created Successfully"
n.get(network)
if opt['delete'] is True:
network = opt['<network>']
if network is not None:
ret = n.delete_network(
network,
)
if ret is False:
print "Unable to delete network"