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
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)
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, )
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
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
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
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
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
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
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)
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(self.context, self._backup_name(), owner_id=self.id) if s is not None: logger.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) logger.debug(_('Created new backup stack')) return prev else: return None