本文整理汇总了Python中cloudmesh_client.cloud.default.Default.list方法的典型用法代码示例。如果您正苦于以下问题:Python Default.list方法的具体用法?Python Default.list怎么用?Python Default.list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.cloud.default.Default
的用法示例。
在下文中一共展示了Default.list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_001
# 需要导入模块: from cloudmesh_client.cloud.default import Default [as 别名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 别名]
def test_001(self):
"""
delete defaults
:return:
"""
HEADING()
Default.clear()
assert Default.list() == None
示例2: test_002
# 需要导入模块: from cloudmesh_client.cloud.default import Default [as 别名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 别名]
def test_002(self):
"""
set default cloud
:return:
"""
HEADING()
result = Default.list()
print(result)
name = "mycloud"
Default.set_cloud(name)
result = Default.list()
print(result)
print ("KKK", Default.get_cloud())
assert Default.get_cloud() == name
self._check(name)
示例3: do_default
# 需要导入模块: from cloudmesh_client.cloud.default import Default [as 别名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 别名]
def do_default(self, args, arguments):
"""
::
Usage:
default list [--cloud=CLOUD] [--format=FORMAT] [--all]
default delete KEY [--cloud=CLOUD]
default KEY [--cloud=CLOUD]
default KEY=VALUE [--cloud=CLOUD]
Arguments:
KEY the name of the default
VALUE the value to set the key to
Options:
--cloud=CLOUD the name of the cloud
--format=FORMAT the output format [default: table]
--all lists all the default values
Description:
Cloudmesh has the ability to manage easily multiple
clouds. One of the key concepts to make the list of such
clouds easier is the introduction of defaults for each
cloud or globally. Hence it is possible to set default
images, flavors for each cloud, and also the default
cloud. The default command is used to set and list the
default values. These defaults are used in other commands
if they are not overwritten by a command parameter.
The current default values can by listed with --all option:(
if you have a default cloud specified. You can also add a
cloud parameter to apply the command to a specific cloud)
default list
A default can be set with
default KEY=VALUE
To look up a default value you can say
default KEY
A default can be deleted with
default delete KEY
Examples:
default list --all
default list --cloud=general
default image=xyz
default image=abc --cloud=kilo
default image
default image --cloud=kilo
default delete image
default delete image --cloud=kilo
"""
# pprint(arguments)
"""
For these keys, the 'cloud' column in db
will always be 'general'.
"""
general_keys = ["cloud", "cluster", "queue"]
"""
If the default cloud has been set (eg. default cloud=xxx),
then subsequent defaults for any key (eg. default image=yyy),
will have 'cloud' column in db as the default cloud that was set.
(eg. image=yyy for cloud=xxx).
"""
if arguments["KEY"] in general_keys:
cloud = "general"
else:
cloud = arguments["--cloud"] or Default.get("cloud", "general") or "general"
if arguments["list"]:
output_format = arguments["--format"]
if arguments['--all'] or arguments["--cloud"] is None:
cloud = None
result = Default.list(cloud=cloud, format=output_format)
if result is None:
Console.error("No default values found")
else:
print(result)
return ""
elif arguments["delete"]:
key = arguments["KEY"]
result = Default.delete(key, cloud)
#.........这里部分代码省略.........
示例4: _check
# 需要导入模块: from cloudmesh_client.cloud.default import Default [as 别名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 别名]
def _check(self, content):
result = Default.list()
print(result)
assert content in str(result)
示例5: do_default
# 需要导入模块: from cloudmesh_client.cloud.default import Default [as 别名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 别名]
def do_default(self, args, arguments):
"""
::
Usage:
default
default list [--cloud=CLOUD] [--format=FORMAT] [--all]
default delete KEY [--cloud=CLOUD]
default KEY [--cloud=CLOUD]
default KEY=VALUE [--cloud=CLOUD]
Arguments:
KEY the name of the default
VALUE the value to set the key to
Options:
--cloud=CLOUD the name of the cloud
--format=FORMAT the output format. Values include
table, json, csv, yaml. [default: table]
--all lists all the default values
Description:
Cloudmesh has the ability to manage easily multiple
clouds. One of the key concepts to manage multiple clouds
is to use defaults for the cloud, the images, flavors,
and other values. The default command is used to manage
such default values. These defaults are used in other commands
if they are not overwritten by a command parameter.
The current default values can by listed with
default list --all
Via the default command you can list, set, get and delete
default values. You can list the defaults with
default list
A default can be set with
default KEY=VALUE
To look up a default value you can say
default KEY
A default can be deleted with
default delete KEY
To be specific to a cloud you can specify the name of the
cloud with the --cloud=CLOUD option. The list command can
print the information in various formats iv specified.
Examples:
default
lists the default for the current default cloud
default list --all
lists all default values
default list --cloud=kilo
lists the defaults for the cloud with the name kilo
default image=xyz
sets the default image for the default cloud to xyz
default image=abc --cloud=kilo
sets the default image for the cloud kilo to xyz
default image
list the default image of the default cloud
default image --cloud=kilo
list the default image of the cloud kilo
default delete image
deletes the value for the default image in the
default cloud
default delete image --cloud=kilo
deletes the value for the default image in the
cloud kilo
"""
# pprint(arguments)
"""
For these keys, the 'cloud' column in db
will always be 'general'.
"""
general_keys = ["cloud", "cluster", "queue"]
"""
If the default cloud has been set (eg. default cloud=xxx),
then subsequent defaults for any key (eg. default image=yyy),
will have 'cloud' column in db as the default cloud that was set.
(eg. image=yyy for cloud=xxx).
"""
#.........这里部分代码省略.........