def _check_want_to_be_running(stackname, autostart=False):
try:
context = context_handler.load_context(stackname)
if not _are_there_existing_servers(context):
return False
except context_handler.MissingContextFile as e:
LOG.warn(e)
instance_list = core.find_ec2_instances(stackname, allow_empty=True)
num_instances = len(instance_list)
if num_instances >= 1:
return instance_list
if not autostart:
should_start = utils._pick('should_start', [True, False], message='Stack not running. Should it be started?')
if not should_start:
return False
core_lifecycle.start(stackname)
# to get the ip addresses that are assigned to the now-running instances
# and that weren't there before
return core.find_ec2_instances(stackname)
评论列表
文章目录