当前位置: 首页>>代码示例>>Python>>正文


Python Clients.keystone方法代码示例

本文整理汇总了Python中heat.engine.clients.Clients.keystone方法的典型用法代码示例。如果您正苦于以下问题:Python Clients.keystone方法的具体用法?Python Clients.keystone怎么用?Python Clients.keystone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在heat.engine.clients.Clients的用法示例。


在下文中一共展示了Clients.keystone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Stack

# 需要导入模块: from heat.engine.clients import Clients [as 别名]
# 或者: from heat.engine.clients.Clients import keystone [as 别名]

#.........这里部分代码省略.........
        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 store(self, backup=False):
        '''
        Store the stack in the database and return its ID
        If self.id is set, we update the existing stack
        '''

        s = {
            'name': self._backup_name() if backup else self.name,
            'raw_template_id': self.t.store(self.context),
            'parameters': self.env.user_env_as_dict(),
            'owner_id': self.owner_id,
            'username': self.context.username,
            'tenant': self.context.tenant_id,
            'action': self.action,
            'status': self.status,
            'status_reason': self.status_reason,
            'timeout': self.timeout_mins,
            'disable_rollback': self.disable_rollback,
        }
        if self.id:
            db_api.stack_update(self.context, self.id, s)
        else:
            # Create a context containing a trust_id and trustor_user_id
            # if trusts are enabled
            if cfg.CONF.deferred_auth_method == 'trusts':
                trust_context = self.clients.keystone().create_trust_context()
                new_creds = db_api.user_creds_create(trust_context)
            else:
                new_creds = db_api.user_creds_create(self.context)
            s['user_creds_id'] = new_creds.id
            new_s = db_api.stack_create(self.context, s)
            self.id = new_s.id

        self._set_param_stackid()

        return self.id

    def _backup_name(self):
        return '%s*' % self.name

    def identifier(self):
        '''
        Return an identifier for this stack.
        '''
        return identifier.HeatIdentifier(self.context.tenant_id,
                                         self.name, self.id)

    def __iter__(self):
        '''
        Return an iterator over this template's resources in the order that
        they should be started.
        '''
        return iter(self.dependencies)

    def __reversed__(self):
        '''
        Return an iterator over this template's resources in the order that
        they should be stopped.
开发者ID:JioCloud,项目名称:heat,代码行数:70,代码来源:parser.py

示例2: Stack

# 需要导入模块: from heat.engine.clients import Clients [as 别名]
# 或者: from heat.engine.clients.Clients import keystone [as 别名]

#.........这里部分代码省略.........
                    user_creds_id=stack.user_creds_id, tenant_id=stack.tenant,
                    validate_parameters=False)

        return stack

    def store(self, backup=False):
        '''
        Store the stack in the database and return its ID
        If self.id is set, we update the existing stack
        '''
        s = {
            'name': self._backup_name() if backup else self.name,
            'raw_template_id': self.t.store(self.context),
            'parameters': self.env.user_env_as_dict(),
            'owner_id': self.owner_id,
            'username': self.context.username,
            'tenant': self.tenant_id,
            'action': self.action,
            'status': self.status,
            'status_reason': self.status_reason,
            'timeout': self.timeout_mins,
            'disable_rollback': self.disable_rollback,
            'stack_user_project_id': self.stack_user_project_id,
            'updated_at': self.updated_time,
            'user_creds_id': self.user_creds_id
        }
        if self.id:
            db_api.stack_update(self.context, self.id, s)
        else:
            if not self.user_creds_id:
                # Create a context containing a trust_id and trustor_user_id
                # if trusts are enabled
                if cfg.CONF.deferred_auth_method == 'trusts':
                    trust_ctx = self.clients.keystone().create_trust_context()
                    new_creds = db_api.user_creds_create(trust_ctx)
                else:
                    new_creds = db_api.user_creds_create(self.context)
                s['user_creds_id'] = new_creds.id
                self.user_creds_id = new_creds.id

            new_s = db_api.stack_create(self.context, s)
            self.id = new_s.id
            self.created_time = new_s.created_at

        self._set_param_stackid()

        return self.id

    def _backup_name(self):
        return '%s*' % self.name

    def identifier(self):
        '''
        Return an identifier for this stack.
        '''
        return identifier.HeatIdentifier(self.tenant_id, self.name, self.id)

    def __iter__(self):
        '''
        Return an iterator over the resource names.
        '''
        return iter(self.resources)

    def __len__(self):
        '''Return the number of resources.'''
        return len(self.resources)
开发者ID:jdandrea,项目名称:heat,代码行数:70,代码来源:parser.py

示例3: Stack

# 需要导入模块: from heat.engine.clients import Clients [as 别名]
# 或者: from heat.engine.clients.Clients import keystone [as 别名]

#.........这里部分代码省略.........
            resolve_data,
            stack.disable_rollback,
            parent_resource,
            owner_id=stack.owner_id,
        )

        return stack

    def store(self, backup=False):
        """
        Store the stack in the database and return its ID
        If self.id is set, we update the existing stack
        """

        s = {
            "name": self._backup_name() if backup else self.name,
            "raw_template_id": self.t.store(self.context),
            "parameters": self.env.user_env_as_dict(),
            "owner_id": self.owner_id,
            "username": self.context.username,
            "tenant": self.context.tenant_id,
            "action": self.action,
            "status": self.status,
            "status_reason": self.status_reason,
            "timeout": self.timeout_mins,
            "disable_rollback": self.disable_rollback,
        }
        if self.id:
            db_api.stack_update(self.context, self.id, s)
        else:
            # Create a context containing a trust_id and trustor_user_id
            # if trusts are enabled
            if cfg.CONF.deferred_auth_method == "trusts":
                trust_context = self.clients.keystone().create_trust_context()
                new_creds = db_api.user_creds_create(trust_context)
            else:
                new_creds = db_api.user_creds_create(self.context)
            s["user_creds_id"] = new_creds.id
            new_s = db_api.stack_create(self.context, s)
            self.id = new_s.id

        self._set_param_stackid()

        return self.id

    def _backup_name(self):
        return "%s*" % self.name

    def identifier(self):
        """
        Return an identifier for this stack.
        """
        return identifier.HeatIdentifier(self.context.tenant_id, self.name, self.id)

    def __iter__(self):
        """
        Return an iterator over the resource names.
        """
        return iter(self.resources)

    def __len__(self):
        """Return the number of resources."""
        return len(self.resources)

    def __getitem__(self, key):
        """Get the resource with the specified name."""
开发者ID:jazeltq,项目名称:heat,代码行数:70,代码来源:parser.py


注:本文中的heat.engine.clients.Clients.keystone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。