本文整理汇总了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
示例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, )
]
示例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'], )
]
示例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)
示例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()
示例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)
示例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'])