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


Python charm.default方法代码示例

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


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

示例1: custom_assess_status_check

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def custom_assess_status_check(self):
        """Verify that the configuration provided is valid and thus the service
        is ready to go.  This will return blocked if the configuraiton is not
        valid for the service.

        :returns (status: string, message: string): the status, and message if
            there is a problem. Or (None, None) if there are no issues.
        """
        options = self.options  # tiny optimisation for less typing.
        backends = options.computed_share_backends
        if not backends:
            return 'blocked', 'No share backends configured'
        default_share_backend = options.default_share_backend
        if not default_share_backend:
            return 'blocked', "'default-share-backend' is not set"
        if default_share_backend not in backends:
            return ('blocked',
                    "'default-share-backend:{}' is not a configured backend"
                    .format(default_share_backend))
        return None, None 
开发者ID:openstack,项目名称:charm-manila,代码行数:22,代码来源:manila.py

示例2: get_database_setup

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def get_database_setup(self):
        """Provide the default database credentials as a list of 3-tuples

        returns a structure of:
        [
            {'database': <database>,
             'username': <username>,
             'hostname': <hostname of this unit>
             'prefix': <the optional prefix for the database>, },
        ]

        :returns [{'database': ...}, ...]: credentials for multiple databases
        """
        return [
            dict(
                database=self.options.database,
                username=self.options.database_user, )
        ] 
开发者ID:openstack,项目名称:charm-manila,代码行数:20,代码来源:manila.py

示例3: get_database_setup

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def get_database_setup(self):
        """Provide the default database credentials as a list of 3-tuples

        returns a structure of:
        [
            {'database': <database>,
             'username': <username>,
             'hostname': <hostname of this unit>
             'prefix': <the optional prefix for the database>, },
        ]

        :returns [{'database': ...}, ...]: credentials for multiple databases
        """
        return [
            dict(
                database=self.config['database'],
                username=self.config['database-user'], )
        ] 
开发者ID:openstack,项目名称:charm-barbican,代码行数:20,代码来源:barbican.py

示例4: states_to_check

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def states_to_check(self, required_relations=None):
        """Override the default states_to_check() for the assess_status
        functionality so that, if we have to have an HSM relation, then enforce
        it on the assess_status() call.

        If param required_relations is not None then it overrides the
        instance/class variable self.required_relations.

        :param required_relations: [list of state names]
        :returns: [states{} as per parent method]
        """
        if required_relations is None:
            required_relations = self.required_relations
        if hookenv.config('require-hsm-plugin'):
            required_relations.append('hsm')
        return super(BarbicanCharm, self).states_to_check(
            required_relations=required_relations) 
开发者ID:openstack,项目名称:charm-barbican,代码行数:19,代码来源:barbican.py

示例5: computed_share_protocols

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def computed_share_protocols(config):
    """Return a list of protocols as a comma (no space) separated list.
    The default protocols are CIFS,NFS.

    :param config: the config option on which to look up config options
    :returns: string
    """
    return strip_join(config.share_protocols, ',').upper() 
开发者ID:openstack,项目名称:charm-manila,代码行数:10,代码来源:manila.py

示例6: get_amqp_credentials

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def get_amqp_credentials(self):
        """Provide the default amqp username and vhost as a tuple.

        :returns (username, host): two strings to send to the amqp provider.
        """
        return (self.options.rabbit_user, self.options.rabbit_vhost) 
开发者ID:openstack,项目名称:charm-manila,代码行数:8,代码来源:manila.py

示例7: get_amqp_credentials

# 需要导入模块: from charms_openstack import charm [as 别名]
# 或者: from charms_openstack.charm import default [as 别名]
def get_amqp_credentials(self):
        """Provide the default amqp username and vhost as a tuple.

        :returns (username, host): two strings to send to the amqp provider.
        """
        return (self.config['rabbit-user'], self.config['rabbit-vhost']) 
开发者ID:openstack,项目名称:charm-barbican,代码行数:8,代码来源:barbican.py


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