本文整理汇总了Python中nailgun.plugins.manager.PluginManager.get_components_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.get_components_metadata方法的具体用法?Python PluginManager.get_components_metadata怎么用?Python PluginManager.get_components_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.plugins.manager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.get_components_metadata方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_raise_exception_when_plugin_overlap_release_component
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def test_raise_exception_when_plugin_overlap_release_component(self):
release = self.env.create_release(
version='2015.1-8.1',
operating_system='Ubuntu',
modes=[consts.CLUSTER_MODES.ha_compact],
components_metadata=self.env.get_default_components())
self.env.create_plugin(
name='plugin_with_components',
package_version='4.0.0',
fuel_version=['8.0'],
releases=[{
'repository_path': 'repositories/ubuntu',
'version': '2015.1-8.1', 'os': 'ubuntu',
'mode': ['ha'],
'deployment_scripts_path': 'deployment_scripts/'}],
components_metadata=self.env.get_default_components())
expected_message = (
'Plugin plugin_with_components is overlapping with release '
'by introducing the same component with name '
'"hypervisor:test_hypervisor"')
with self.assertRaisesRegexp(errors.AlreadyExists,
expected_message):
PluginManager.get_components_metadata(release)
示例2: get_all_components
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def get_all_components(cls, instance):
"""Get all components related to release
Due to components architecture compatible/incompatible are duplex
relations. So if some component is compatible/incompatible with another
the last one also should have such relation.
:param instance: Release instance
:type instance: Release DB instance
:returns: list -- list of all components
"""
plugin_components = PluginManager.get_components_metadata(instance)
components = copy.deepcopy(
instance.components_metadata + plugin_components)
# we should provide commutative property for compatible/incompatible
# relations between components
for comp_i, comp_j in itertools.permutations(components, 2):
if cls._check_relation(comp_j, comp_i, 'incompatible'):
comp_i.setdefault('incompatible', []).append({
'name': comp_j['name'],
'message': "Not compatible with {0}".format(
comp_j.get('label') or comp_j.get('name'))})
if cls._check_relation(comp_j, comp_i, 'compatible'):
comp_i.setdefault('compatible', []).append({
'name': comp_j['name']})
return components
示例3: get_all_components
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def get_all_components(cls, instance):
"""Get all components related to release
:param instance: Release instance
:type instance: Release DB instance
:returns: list -- list of all components
"""
plugin_components = PluginManager.get_components_metadata(instance)
return instance.components_metadata + plugin_components
示例4: test_get_components
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def test_get_components(self):
self.env.create_plugin(
name='plugin_with_components',
package_version='4.0.0',
fuel_version=['8.0'],
components_metadata=self.env.get_default_components())
components_metadata = PluginManager.get_components_metadata(
self.release)
self.assertEqual(
components_metadata, self.env.get_default_components())
示例5: test_raise_exception_when_plugin_overlap_another_component
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def test_raise_exception_when_plugin_overlap_another_component(self):
self.env.create_plugin(
name='plugin_with_components_1',
package_version='4.0.0',
fuel_version=['8.0'],
components_metadata=self.env.get_default_components())
self.env.create_plugin(
name='plugin_with_components_2',
package_version='4.0.0',
fuel_version=['8.0'],
components_metadata=self.env.get_default_components())
expected_message = (
'Plugin plugin_with_components_2 is overlapping with '
'plugin_with_components_1 by introducing the same component '
'with name "hypervisor:test_hypervisor"')
with self.assertRaisesRegexp(errors.AlreadyExists,
expected_message):
PluginManager.get_components_metadata(self.release)
示例6: test_get_components_for_same_plugins_with_different_verions
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_components_metadata [as 别名]
def test_get_components_for_same_plugins_with_different_verions(self):
self.env.create_plugin(
name='plugin_with_components_to_test_verions',
package_version='4.0.0',
fuel_version=['8.0'],
components_metadata=self.env.get_default_components())
self.env.create_plugin(
name='plugin_with_components_to_test_verions',
version='1.0.0',
package_version='4.0.0',
fuel_version=['8.0'],
components_metadata=self.env.get_default_components())
# PluginManager should return only one component for same plugin
# but different versions
components_metadata = PluginManager.get_components_metadata(
self.release)
self.assertEqual(
components_metadata, self.env.get_default_components())