本文整理汇总了Python中appscale.tools.appscale_logger.AppScaleLogger.success方法的典型用法代码示例。如果您正苦于以下问题:Python AppScaleLogger.success方法的具体用法?Python AppScaleLogger.success怎么用?Python AppScaleLogger.success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.appscale_logger.AppScaleLogger
的用法示例。
在下文中一共展示了AppScaleLogger.success方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register
# 需要导入模块: from appscale.tools.appscale_logger import AppScaleLogger [as 别名]
# 或者: from appscale.tools.appscale_logger.AppScaleLogger import success [as 别名]
def register(self, deployment_id):
""" Allows users to register their AppScale deployment with the AppScale
Portal.
Raises:
AppScaleException: If the deployment has already been registered.
"""
appscale_yaml = yaml.safe_load(self.read_appscalefile())
if 'keyname' in appscale_yaml:
keyname = appscale_yaml['keyname']
else:
keyname = 'appscale'
nodes = self.get_nodes(keyname)
head_node = self.get_head_node(nodes)
if RegistrationHelper.appscale_has_deployment_id(head_node, keyname):
existing_id = RegistrationHelper.get_deployment_id(head_node, keyname)
if existing_id != deployment_id:
raise AppScaleException(
'This deployment has already been registered with a different ID.')
if 'infrastructure' in appscale_yaml:
deployment_type = 'cloud'
else:
deployment_type = 'cluster'
deployment = RegistrationHelper.update_deployment(deployment_type, nodes,
deployment_id)
RegistrationHelper.set_deployment_id(head_node, keyname, deployment_id)
AppScaleLogger.success(
'Registration complete for AppScale deployment {0}.'
.format(deployment['name']))
示例2: down
# 需要导入模块: from appscale.tools.appscale_logger import AppScaleLogger [as 别名]
# 或者: from appscale.tools.appscale_logger.AppScaleLogger import success [as 别名]
def down(self, clean=False, terminate=False):
""" 'down' provides a nicer experience for users than the
appscale-terminate-instances command, by using the configuration options
present in the AppScalefile found in the current working directory.
Args:
clean: A boolean to indicate if the deployment data and metadata
needs to be clean. This will clear the datastore.
terminate: A boolean to indicate if instances needs to be terminated
(valid only if we spawn instances at start).
Raises:
AppScalefileException: If there is no AppScalefile in the current working
directory.
"""
contents = self.read_appscalefile()
# Construct a terminate-instances command from the file's contents
command = []
contents_as_yaml = yaml.safe_load(contents)
if 'verbose' in contents_as_yaml and contents_as_yaml['verbose'] == True:
command.append("--verbose")
if 'keyname' in contents_as_yaml:
keyname = contents_as_yaml['keyname']
command.append("--keyname")
command.append(contents_as_yaml['keyname'])
else:
keyname = 'appscale'
if clean:
if 'test' not in contents_as_yaml or contents_as_yaml['test'] != True:
LocalState.confirm_or_abort("Clean will delete every data in the deployment.")
command.append("--clean")
if terminate:
infrastructure = LocalState.get_infrastructure(keyname)
if infrastructure != "xen" and not LocalState.are_disks_used(
keyname) and 'test' not in contents_as_yaml:
LocalState.confirm_or_abort("Terminate will delete instances and the data on them.")
command.append("--terminate")
if 'test' in contents_as_yaml and contents_as_yaml['test'] == True:
command.append("--test")
# Finally, exec the command. Don't worry about validating it -
# appscale-terminate-instances will do that for us.
options = ParseArgs(command, "appscale-terminate-instances").args
AppScaleTools.terminate_instances(options)
LocalState.cleanup_appscale_files(keyname, terminate)
AppScaleLogger.success("Successfully stopped your AppScale deployment.")