本文整理汇总了Python中charmhelpers.contrib.openstack.context.interfaces方法的典型用法代码示例。如果您正苦于以下问题:Python context.interfaces方法的具体用法?Python context.interfaces怎么用?Python context.interfaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.contrib.openstack.context
的用法示例。
在下文中一共展示了context.interfaces方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: context
# 需要导入模块: from charmhelpers.contrib.openstack import context [as 别名]
# 或者: from charmhelpers.contrib.openstack.context import interfaces [as 别名]
def context(self):
ctxt = {}
for context in self.contexts:
_ctxt = context()
if _ctxt:
ctxt.update(_ctxt)
# track interfaces for every complete context.
[self._complete_contexts.append(interface)
for interface in context.interfaces
if interface not in self._complete_contexts]
return ctxt
示例2: complete_contexts
# 需要导入模块: from charmhelpers.contrib.openstack import context [as 别名]
# 或者: from charmhelpers.contrib.openstack.context import interfaces [as 别名]
def complete_contexts(self):
'''
Return a list of interfaces that have satisfied contexts.
'''
if self._complete_contexts:
return self._complete_contexts
self.context()
return self._complete_contexts
示例3: get_incomplete_context_data
# 需要导入模块: from charmhelpers.contrib.openstack import context [as 别名]
# 或者: from charmhelpers.contrib.openstack.context import interfaces [as 别名]
def get_incomplete_context_data(self, interfaces):
'''
Return dictionary of relation status of interfaces and any missing
required context data. Example:
{'amqp': {'missing_data': ['rabbitmq_password'], 'related': True},
'zeromq-configuration': {'related': False}}
'''
incomplete_context_data = {}
for i in six.itervalues(self.templates):
for context in i.contexts:
for interface in interfaces:
related = False
if interface in context.interfaces:
related = context.get_related()
missing_data = context.missing_data
if missing_data:
incomplete_context_data[interface] = {'missing_data': missing_data}
if related:
if incomplete_context_data.get(interface):
incomplete_context_data[interface].update({'related': True})
else:
incomplete_context_data[interface] = {'related': True}
else:
incomplete_context_data[interface] = {'related': False}
return incomplete_context_data
示例4: complete_contexts
# 需要导入模块: from charmhelpers.contrib.openstack import context [as 别名]
# 或者: from charmhelpers.contrib.openstack.context import interfaces [as 别名]
def complete_contexts(self):
'''
Returns a list of context interfaces that yield a complete context.
'''
interfaces = []
[interfaces.extend(i.complete_contexts())
for i in six.itervalues(self.templates)]
return interfaces