本文整理匯總了Python中cloudmesh_client.common.ConfigDict.ConfigDict.data["cloudmesh"]["comet"]["active"]方法的典型用法代碼示例。如果您正苦於以下問題:Python ConfigDict.data["cloudmesh"]["comet"]["active"]方法的具體用法?Python ConfigDict.data["cloudmesh"]["comet"]["active"]怎麽用?Python ConfigDict.data["cloudmesh"]["comet"]["active"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cloudmesh_client.common.ConfigDict.ConfigDict
的用法示例。
在下文中一共展示了ConfigDict.data["cloudmesh"]["comet"]["active"]方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: do_comet
# 需要導入模塊: from cloudmesh_client.common.ConfigDict import ConfigDict [as 別名]
# 或者: from cloudmesh_client.common.ConfigDict.ConfigDict import data["cloudmesh"]["comet"]["active"] [as 別名]
#.........這裏部分代碼省略.........
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)
)
if set_endpoint_url:
if set_endpoint_url != endpoint_url:
config.data["cloudmesh"]["comet"]["endpoints"] \
[cometConf['active']]["nucleus_base_url"] \
= set_endpoint_url
config.save()
Console.ok("Service base url set!")
set_api_version = \
input("Set the api version for the nucleus %s service [%s]: " \
% (cometConf['active'],
api_version)
)
示例2: do_comet
# 需要導入模塊: from cloudmesh_client.common.ConfigDict import ConfigDict [as 別名]
# 或者: from cloudmesh_client.common.ConfigDict.ConfigDict import data["cloudmesh"]["comet"]["active"] [as 別名]
#.........這裏部分代碼省略.........
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)
)
if set_endpoint_url:
if set_endpoint_url != endpoint_url:
config.data["cloudmesh"]["comet"]["endpoints"]\
[cometConf['active']]["nucleus_base_url"]\
= set_endpoint_url
config.save()
Console.ok("Service base url set!")
set_api_version = \
input("Set the api version for the nucleus %s service [%s]: "\
% (cometConf['active'],
api_version)
)
if set_api_version: