本文整理汇总了Python中cloudmesh_client.common.ConfigDict.ConfigDict.data["cloudmesh"]["comet"]["username"]方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigDict.data["cloudmesh"]["comet"]["username"]方法的具体用法?Python ConfigDict.data["cloudmesh"]["comet"]["username"]怎么用?Python ConfigDict.data["cloudmesh"]["comet"]["username"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.common.ConfigDict.ConfigDict
的用法示例。
在下文中一共展示了ConfigDict.data["cloudmesh"]["comet"]["username"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_comet
# 需要导入模块: from cloudmesh_client.common.ConfigDict import ConfigDict [as 别名]
# 或者: from cloudmesh_client.common.ConfigDict.ConfigDict import data["cloudmesh"]["comet"]["username"] [as 别名]
#.........这里部分代码省略.........
print("start", cluster_id)
Cluster.start(cluster_id)
elif arguments["stop"]:
cluster_id = arguments["ID"]
print("stop", cluster_id)
Cluster.stop(cluster_id)
elif arguments["ll"]:
"""
if arguments["init"]:
print ("Initializing the comet configuration file...")
config = ConfigDict("cloudmesh.yaml")
# for unit testing only.
cometConf = config["cloudmesh.comet"]
endpoints = []
# print (cometConf.keys())
if "endpoints" in cometConf.keys():
endpoints = cometConf["endpoints"].keys()
if len(endpoints) < 1:
Console.error("No service endpoints available. "
"Please check the config template",
traceflag=False)
return ""
if "username" in cometConf.keys():
default_username = cometConf['username']
# print (default_username)
if 'TBD' == default_username:
set_default_user = \
input("Set a default username (RETURN to skip): ")
if set_default_user:
config.data["cloudmesh"]["comet"]["username"] = \
set_default_user
config.save()
Console.ok("Comet default username set!")
if "active" in cometConf.keys():
active_endpoint = cometConf['active']
set_active_endpoint = \
input("Set the active service endpoint to use. "
"The availalbe endpoints are - %s [%s]: "
% ("/".join(endpoints),
active_endpoint)
)
if set_active_endpoint:
if set_active_endpoint in endpoints:
config.data["cloudmesh"]["comet"]["active"] = \
set_active_endpoint
config.save()
Console.ok("Comet active service endpoint set!")
else:
Console.error("The provided endpoint does not match "
"any available service endpoints. Try %s"
% "/".join(endpoints),
traceflag=False)
if cometConf['active'] in endpoints:
endpoint_url = cometConf["endpoints"] \
[cometConf['active']]["nucleus_base_url"]
api_version = cometConf["endpoints"] \
[cometConf['active']]["api_version"]
set_endpoint_url = \
input("Set the base url for the nucleus %s service [%s]: " \
% (cometConf['active'],
endpoint_url)
示例2: do_comet
# 需要导入模块: from cloudmesh_client.common.ConfigDict import ConfigDict [as 别名]
# 或者: from cloudmesh_client.common.ConfigDict.ConfigDict import data["cloudmesh"]["comet"]["username"] [as 别名]
#.........这里部分代码省略.........
cluster_id = arguments["ID"]
print("start", cluster_id)
Cluster.start(cluster_id)
elif arguments["stop"]:
cluster_id = arguments["ID"]
print("stop", cluster_id)
Cluster.stop(cluster_id)
elif arguments["ll"]:
"""
if arguments["init"]:
print ("Initializing the comet configuration file...")
config = ConfigDict("cloudmesh.yaml")
# for unit testing only.
cometConf = config["cloudmesh.comet"]
endpoints = []
# print (cometConf.keys())
if "endpoints" in cometConf.keys():
endpoints = cometConf["endpoints"].keys()
if len(endpoints) < 1:
Console.error("No service endpoints available."\
" Please check the config template")
return ""
if "username" in cometConf.keys():
default_username = cometConf['username']
# print (default_username)
if 'TBD' == default_username:
set_default_user = \
input("Set a default username (RETURN to skip): ")
if set_default_user:
config.data["cloudmesh"]["comet"]["username"] = \
set_default_user
config.save()
Console.ok("Comet default username set!")
if "active" in cometConf.keys():
active_endpoint = cometConf['active']
set_active_endpoint = \
input("Set the active service endpoint to use. "\
"The availalbe endpoints are - %s [%s]: "\
% ("/".join(endpoints),
active_endpoint)
)
if set_active_endpoint:
if set_active_endpoint in endpoints:
config.data["cloudmesh"]["comet"]["active"] = \
set_active_endpoint
config.save()
Console.ok("Comet active service endpoint set!")
else:
Console.error("The provided endpoint does not match any "\
"available service endpoints. Try %s" \
% "/".join(endpoints) )
if cometConf['active'] in endpoints:
endpoint_url = cometConf["endpoints"]\
[cometConf['active']]["nucleus_base_url"]
api_version = cometConf["endpoints"]\
[cometConf['active']]["api_version"]
set_endpoint_url = \
input("Set the base url for the nucleus %s service [%s]: "\
% (cometConf['active'],
endpoint_url)
)