本文整理汇总了Python中cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider.deactivate方法的典型用法代码示例。如果您正苦于以下问题:Python CloudProvider.deactivate方法的具体用法?Python CloudProvider.deactivate怎么用?Python CloudProvider.deactivate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider
的用法示例。
在下文中一共展示了CloudProvider.deactivate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_cloud
# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import deactivate [as 别名]
def do_cloud(self, args, arguments):
"""
::
Usage:
cloud list [--cloud=CLOUD] [--format=FORMAT]
cloud logon CLOUD
cloud logout CLOUD
cloud activate CLOUD
cloud deactivate CLOUD
cloud info CLOUD
managing the admins test test test test
Arguments:
KEY the name of the admin
VALUE the value to set the key to
Options:
--cloud=CLOUD the name of the cloud
--format=FORMAT the output format [default: table]
Description:
Cloudmesh contains a cloudmesh.yaml file that contains
templates for multiple clouds that you may or may not have
access to. Hence it is useful to activate and deactivate clouds
you like to use in other commands.
To activate a cloud a user can simply use the activate
command followed by the name of the cloud to be
activated. To find out which clouds are available you can
use the list command that will provide you with some
basic information. As default it will print a table. Thus
the commands::
cloud activate india
cloud deactivate aws
Will result in
+----------------------+--------+-------------------+
| Cloud name | Active | Type |
+----------------------+--------+-------------------+
| india | True | Openstack |
+----------------------+--------+-------------------+
| aws | False | AWS |
+----------------------+--------+-------------------+
To get ore information about the cloud you can use the command
cloud info CLOUD
It will call internally also the command uses in register
See also:
register
"""
cloudname = arguments["--cloud"] or Default.cloud
if arguments["logon"]:
cloudname = arguments["CLOUD"]
provider = CloudProvider(cloudname).provider
provider.logon(cloudname)
Console.ok("Logged into cloud: " + cloudname)
elif arguments["logout"]:
cloudname = arguments["CLOUD"]
provider = CloudProvider(cloudname).provider
provider.logout(cloudname)
Console.ok("Logged out of cloud: " + cloudname)
elif arguments["activate"]:
cloudname = arguments["CLOUD"]
provider = CloudProvider(cloudname).provider
provider.activate(cloudname)
Console.ok("Activated cloud: " + cloudname)
elif arguments["deactivate"]:
cloudname = arguments["CLOUD"]
provider = CloudProvider(cloudname).provider
provider.deactivate(cloudname)
Console.ok("Deactivated cloud: " + cloudname)
elif arguments["list"]:
provider = CloudProvider(cloudname).provider
clouds = provider.list_clouds()
default = Default.cloud
active = ConfigDict("cloudmesh.yaml")["cloudmesh"]["active"]
key = Default.key
def yes(state):
if state:
return "*"
else:
return " "
for index in clouds:
cloud = clouds[index]
cloud["active"] = yes(cloud["cloud"] in active)
#.........这里部分代码省略.........