本文整理汇总了Python中cloudmesh_client.common.Printer.Printer.row_table方法的典型用法代码示例。如果您正苦于以下问题:Python Printer.row_table方法的具体用法?Python Printer.row_table怎么用?Python Printer.row_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.common.Printer.Printer
的用法示例。
在下文中一共展示了Printer.row_table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_nova
# 需要导入模块: from cloudmesh_client.common.Printer import Printer [as 别名]
# 或者: from cloudmesh_client.common.Printer.Printer import row_table [as 别名]
def do_nova(self, args, arguments):
"""
::
Usage:
nova set CLOUD
nova info [CLOUD] [--password]
nova help
nova [--group=GROUP] ARGUMENTS...
A simple wrapper for the openstack nova command
Arguments:
GROUP The group to add vms to
ARGUMENTS The arguments passed to nova
help Prints the nova manual
set reads the information from the current cloud
and updates the environment variables if
the cloud is an openstack cloud
info the environment values for OS
Options:
--group=GROUP Add VM to GROUP group
--password Prints the password
-v verbose mode
"""
# pprint(arguments)
cloud = arguments['CLOUD'] or Default.cloud
if not cloud:
Console.error("Default cloud not set!")
return ""
group = arguments["--group"] or Default.group
if not group:
Console.error("Default group not set!")
return ""
if arguments["help"]:
os.system("nova help")
return ""
elif arguments["info"]:
set_os_environ(cloud)
d = {}
#
# TODO: this naturally does not work as clouds will have
# different parameters. ALos it does not unset previous
# parameters from other clouds. See register
#
for attribute in ['OS_USERNAME',
'OS_TENANT_NAME',
'OS_AUTH_URL',
'OS_CACERT',
'OS_PASSWORD',
'OS_REGION']:
try:
d[attribute] = os.environ[attribute]
except:
Console.warning("OS environment variable {:} not found"
.format(attribute))
d[attribute] = None
if not arguments["--password"]:
d['OS_PASSWORD'] = "********"
print(Printer.row_table(d, order=None, labels=["Variable", "Value"]))
msg = "info. OK."
Console.ok(msg)
return ""
elif arguments["set"]:
if cloud:
set_os_environ(cloud)
msg = "{0} is set".format(cloud)
Console.ok(msg)
else:
Console.error("CLOUD is required")
else: # nova ARGUMENTS...
print("Cloud = {0}".format(cloud))
try:
set_os_environ(cloud)
args = arguments["ARGUMENTS"]
# arguments may contain multiple optional arguments
if len(args) == 1:
args = args[0].split()
result = Shell.execute("nova", args)
print (result)
# print(Nova.remove_subjectAltName_warning(result))
"""
If request for nova boot,
add the vm to group specified,
or else add to default group
"""
if "boot" in args:
#.........这里部分代码省略.........