本文整理汇总了Python中heat.engine.template.Template.load方法的典型用法代码示例。如果您正苦于以下问题:Python Template.load方法的具体用法?Python Template.load怎么用?Python Template.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类heat.engine.template.Template
的用法示例。
在下文中一共展示了Template.load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def load(cls, context, stack_id=None, stack=None, resolve_data=True,
parent_resource=None, show_deleted=True):
'''Retrieve a Stack from the database.'''
if stack is None:
stack = db_api.stack_get(context, stack_id,
show_deleted=show_deleted,
eager_load=True)
if stack is None:
message = _('No stack exists with id "%s"') % str(stack_id)
raise exception.NotFound(message)
template = Template.load(
context, stack.raw_template_id, stack.raw_template)
env = environment.Environment(stack.parameters)
stack = cls(context, stack.name, template, env,
stack.id, stack.action, stack.status, stack.status_reason,
stack.timeout, resolve_data, stack.disable_rollback,
parent_resource, owner_id=stack.owner_id,
stack_user_project_id=stack.stack_user_project_id,
created_time=stack.created_at,
updated_time=stack.updated_at,
user_creds_id=stack.user_creds_id, tenant_id=stack.tenant,
validate_parameters=False)
return stack
示例2: _from_db
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def _from_db(cls, context, stack, parent_resource=None, resolve_data=True, use_stored_context=False):
template = Template.load(context, stack.raw_template_id, stack.raw_template)
env = environment.Environment(stack.parameters)
return cls(
context,
stack.name,
template,
env,
stack.id,
stack.action,
stack.status,
stack.status_reason,
stack.timeout,
resolve_data,
stack.disable_rollback,
parent_resource,
owner_id=stack.owner_id,
stack_user_project_id=stack.stack_user_project_id,
created_time=stack.created_at,
updated_time=stack.updated_at,
user_creds_id=stack.user_creds_id,
tenant_id=stack.tenant,
validate_parameters=False,
use_stored_context=use_stored_context,
)
示例3: load
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def load(cls, context, stack_id=None, stack=None, resolve_data=True, parent_resource=None, show_deleted=True):
"""Retrieve a Stack from the database."""
if stack is None:
stack = db_api.stack_get(context, stack_id, show_deleted=show_deleted)
if stack is None:
message = _('No stack exists with id "%s"') % str(stack_id)
raise exception.NotFound(message)
template = Template.load(context, stack.raw_template_id)
env = environment.Environment(stack.parameters)
stack = cls(
context,
stack.name,
template,
env,
stack.id,
stack.action,
stack.status,
stack.status_reason,
stack.timeout,
resolve_data,
stack.disable_rollback,
parent_resource,
owner_id=stack.owner_id,
)
return stack
示例4: load
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def load(cls, context, stack_id=None, stack=None, resolve_data=True):
'''Retrieve a Stack from the database.'''
if stack is None:
stack = db_api.stack_get(context, stack_id)
if stack is None:
message = 'No stack exists with id "%s"' % str(stack_id)
raise exception.NotFound(message)
template = Template.load(context, stack.raw_template_id)
params = Parameters(stack.name, template, stack.parameters)
stack = cls(context, stack.name, template, params,
stack.id, stack.status, stack.status_reason, stack.timeout,
resolve_data, stack.disable_rollback)
return stack
示例5: _backup_stack
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def _backup_stack(self, create_if_missing=True):
"""
Get a Stack containing any in-progress resources from the previous
stack state prior to an update.
"""
s = db_api.stack_get_by_name_and_owner_id(self.context, self._backup_name(), owner_id=self.id)
if s is not None:
LOG.debug("Loaded existing backup stack")
return self.load(self.context, stack=s)
elif create_if_missing:
templ = Template.load(self.context, self.t.id)
templ.files = copy.deepcopy(self.t.files)
prev = type(self)(self.context, self.name, templ, self.env, owner_id=self.id)
prev.store(backup=True)
LOG.debug("Created new backup stack")
return prev
else:
return None
示例6: _from_db
# 需要导入模块: from heat.engine.template import Template [as 别名]
# 或者: from heat.engine.template.Template import load [as 别名]
def _from_db(cls, context, stack, parent_resource=None, resolve_data=True,
use_stored_context=False):
template = Template.load(
context, stack.raw_template_id, stack.raw_template)
env = environment.Environment(stack.parameters)
return cls(context, stack.name, template, env,
stack.id, stack.action, stack.status, stack.status_reason,
stack.timeout, resolve_data, stack.disable_rollback,
parent_resource, owner_id=stack.owner_id,
stack_user_project_id=stack.stack_user_project_id,
created_time=stack.created_at,
updated_time=stack.updated_at,
user_creds_id=stack.user_creds_id, tenant_id=stack.tenant,
use_stored_context=use_stored_context,
username=stack.username,
#add by xm-20150603
stack_apps_style=stack.stack_apps_style, isscaler=stack.isscaler,
enduser=stack.enduser, description=stack.description,
app_name=stack.app_name, template_id=stack.template_id)