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


Python Plugin.create方法代码示例

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


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

示例1: test_all_newest

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def test_all_newest(self):
        for version in ['1.0.0', '2.0.0', '0.0.1']:
            plugin_data = self.env.get_default_plugin_metadata(
                version=version,
                name='multiversion_plugin')
            Plugin.create(plugin_data)

        single_plugin_data = self.env.get_default_plugin_metadata(
            name='single_plugin')
        Plugin.create(single_plugin_data)

        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 2)

        single_plugin = filter(
            lambda p: p.name == 'single_plugin',
            newest_plugins)
        multiversion_plugin = filter(
            lambda p: p.name == 'multiversion_plugin',
            newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, '2.0.0')
开发者ID:TorstenS73,项目名称:fuel-web,代码行数:27,代码来源:test_object_plugin.py

示例2: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
 def setUp(self):
     super(TestMigrationPluginsClusterAttrs, self).setUp()
     self.cluster = self.env.create()
     self.plugins = [
         Plugin.create(self.env.get_default_plugin_metadata(
             name='plugin_name_1')),
         Plugin.create(self.env.get_default_plugin_metadata(
             name='plugin_name_2'))]
开发者ID:ekorekin,项目名称:fuel-web,代码行数:10,代码来源:test_migration_plugins_cluster_attrs_use_ids_mapping.py

示例3: _create_test_plugins

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def _create_test_plugins(self):
        plugin_ids = []
        for version in ['1.0.0', '2.0.0', '0.0.1', '3.0.0']:
            plugin_data = self.env.get_default_plugin_metadata(
                version=version,
                name='multiversion_plugin')
            plugin = Plugin.create(plugin_data)
            plugin_ids.append(plugin.id)

        single_plugin_data = self.env.get_default_plugin_metadata(
            name='single_plugin')
        plugin = Plugin.create(single_plugin_data)
        plugin_ids.append(plugin.id)

        return plugin_ids
开发者ID:SmartInfrastructures,项目名称:fuel-web-dev,代码行数:17,代码来源:test_object_plugin.py

示例4: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def setUp(self):
        super(TestNailgunReceiver, self).setUp()

        self.env.create(
            status=consts.CLUSTER_STATUSES.operational,
            nodes_kwargs=[
                {'roles': ['controller'],
                 'status': consts.NODE_STATUSES.ready}])
        self.cluster = self.env.clusters[0]

        for i in range(2):
            meta = self.env.get_default_plugin_metadata(
                name='name{0}'.format(i),
                title='title{0}'.format(i),
                description='description{0}'.format(i))

            self.plugin = Plugin.create(meta)
            self.cluster.plugins.append(self.plugin)
            ClusterPlugins.set_attributes(self.cluster.id,
                                          self.plugin.id,
                                          enabled=True)

        self.task = self.env.create_task(
            name=consts.TASK_NAMES.deployment,
            status=consts.TASK_STATUSES.ready,
            cluster_id=self.cluster.id)
开发者ID:dnikishov,项目名称:fuel-web,代码行数:28,代码来源:test_receiver.py

示例5: test_add_nodes_for_cluster_plugin_with_empty_attributes

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def test_add_nodes_for_cluster_plugin_with_empty_attributes(self):
        meta = base.reflect_db_metadata()
        self.env.create_node(
            cluster_id=self.cluster.id,
            roles=['compute']
        )
        plugin = Plugin.create({
            'name': 'plugin_a_with_node_attributes',
            'title': 'Test Plugin',
            'package_version': '5.0.0',
            'version': '1.0.0',
            'node_attributes_metadata': {}
        })
        cluster_plugin = ClusterPlugin.create({
            'cluster_id': self.cluster.id,
            'plugin_id': plugin.id,
            'enabled': False,
            'attributes': plugin.node_attributes_metadata
        })

        NodeClusterPlugin.add_nodes_for_cluster_plugin(cluster_plugin)

        node_cluster_plugins = self.db.execute(
            meta.tables['node_cluster_plugins'].select()
        ).fetchall()
        self.assertEqual(0, len(node_cluster_plugins))
开发者ID:openstack,项目名称:fuel-web,代码行数:28,代码来源:test_object_plugin.py

示例6: _create_test_plugins

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def _create_test_plugins(self):
        plugin_ids = []
        for version in ["1.0.0", "2.0.0", "0.0.1", "3.0.0", "4.0.0", "5.0.0"]:
            plugin_data = self.env.get_default_plugin_metadata(version=version, name="multiversion_plugin")
            plugin = Plugin.create(plugin_data)
            plugin_ids.append(plugin.id)

        single_plugin_data = self.env.get_default_plugin_metadata(name="single_plugin")
        plugin = Plugin.create(single_plugin_data)
        plugin_ids.append(plugin.id)

        incompatible_plugin_data = self.env.get_default_plugin_metadata(name="incompatible_plugin", releases=[])
        plugin = Plugin.create(incompatible_plugin_data)
        plugin_ids.append(plugin.id)

        return plugin_ids
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:18,代码来源:test_object_plugin.py

示例7: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
 def setUp(self):
     super(TestClusterCompatibilityValidation, self).setUp()
     self.plugin = Plugin.create(self.env.get_default_plugin_metadata(
         releases=[{
             'version': '2014.2-6.0',
             'os': 'ubuntu',
             'mode': ['ha']}]))
     self.plugin_adapter = adapters.PluginAdapterV1(self.plugin)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:10,代码来源:test_plugin_adapters.py

示例8: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
 def setUp(self):
     super(TestClusterCompatiblityValidation, self).setUp()
     self.plugin = Plugin.create(self.env.get_default_plugin_metadata(
         releases=[{
             'version': '2014.2-6.0',
             'os': 'ubuntu',
             'mode': ['ha']}]))
     self.attr_plugin = attr_plugin.ClusterAttributesPluginV1(self.plugin)
开发者ID:nebril,项目名称:fuel-web,代码行数:10,代码来源:test_attributes_plugin.py

示例9: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def setUp(self):
        super(TestPluginBase, self).setUp()
        self.plugin_metadata = self.env.get_default_plugin_metadata(
            package_version=self.package_version,
            roles_metadata={
                'role_x': {
                    'name': 'Role X',
                    'description': 'Role X is ...',
                },
                'role_y': {
                    'name': 'Role Y',
                    'description': 'Role Y is ...',
                    'restrictions': [],
                    'fault_tolerance': '5%'
                },
                'role_z': {
                    'name': 'Role Z',
                    'description': 'Role Z is ...',
                    'restrictions': [
                        'settings:some.stuff.value == false'
                    ],
                    'fault_tolerance': '10%'
                }
            }
        )
        self.plugin = Plugin.create(self.plugin_metadata)
        self.cluster = self.env.create(
            cluster_kwargs={'mode': consts.CLUSTER_MODES.multinode},
            release_kwargs={
                'version': '2015.1-8.0',
                'operating_system': 'Ubuntu',
                'modes': [consts.CLUSTER_MODES.multinode,
                          consts.CLUSTER_MODES.ha_compact]})
        self.plugin_adapter = plugins.wrap_plugin(self.plugin)
        self.env_config = self.env.get_default_plugin_env_config()
        self.get_config = lambda *args: mock.mock_open(
            read_data=yaml.dump(self.env_config))()

        db().flush()
开发者ID:openstack,项目名称:fuel-web,代码行数:41,代码来源:test_plugin_adapters.py

示例10: create_plugin

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def create_plugin(self, api=False, cluster=None, **kwargs):
        plugin_data = self.get_default_plugin_metadata()
        plugin_data.update(kwargs)

        if api:
            resp = self.app.post(
                reverse("PluginCollectionHandler"),
                jsonutils.dumps(plugin_data),
                headers=self.default_headers,
                expect_errors=False,
            )

            plugin = Plugin.get_by_uid(resp.json_body["id"])
            self.plugins.append(plugin)
        else:
            plugin = Plugin.create(plugin_data)
            self.plugins.append(plugin)

        # Enable plugin for specific cluster
        if cluster:
            cluster.plugins.append(plugin)

        return plugin
开发者ID:thefuyang,项目名称:fuel-web,代码行数:25,代码来源:base.py

示例11: test_graphs_creation

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
    def test_graphs_creation(self):
        metadata_update = {
            'name': 'graphs_plugin',
            'description': 'testing graphs',
            'package_version': '5.0.0',
            'graphs': [
                {
                    'type': 'default',
                    'name': 'default',
                    'tasks': [
                        {'id': 'default', 'type': 'puppet'}
                    ]
                },
                {
                    'type': 'custom',
                    'name': 'custom',
                    'tasks': [
                        {'id': 'custom', 'type': 'puppet'}
                    ]
                }
            ]}
        metadata = self.env.get_default_plugin_metadata()
        metadata.update(metadata_update)
        plugin = Plugin.create(metadata)

        def_graph = DeploymentGraph.get_for_model(
            plugin, graph_type='default'
        )
        self.assertEqual(def_graph.name, 'default')
        self.assertEqual(
            DeploymentGraph.get_tasks(def_graph),
            [
                {
                    'id': 'default',
                    'task_name': 'default',
                    'type': 'puppet',
                    'version': '1.0.0'
                }
            ]
        )

        custom_graph = DeploymentGraph.get_for_model(
            plugin, graph_type='custom'
        )
        self.assertEqual(custom_graph.name, 'custom')
        self.assertEqual(
            DeploymentGraph.get_tasks(custom_graph),
            [
                {
                    'id': 'custom',
                    'task_name': 'custom',
                    'type': 'puppet',
                    'version': '1.0.0'
                }
            ]
        )

        Plugin.update(plugin, metadata)

        def_graph = DeploymentGraph.get_for_model(
            plugin, graph_type='default'
        )
        self.assertEqual(def_graph.name, 'default')
        self.assertEqual(
            DeploymentGraph.get_tasks(def_graph),
            [
                {
                    'id': 'default',
                    'task_name': 'default',
                    'type': 'puppet',
                    'version': '1.0.0'
                }
            ]
        )

        custom_graph = DeploymentGraph.get_for_model(
            plugin, graph_type='custom'
        )
        self.assertEqual(custom_graph.name, 'custom')
        self.assertEqual(
            DeploymentGraph.get_tasks(custom_graph),
            [
                {
                    'id': 'custom',
                    'task_name': 'custom',
                    'type': 'puppet',
                    'version': '1.0.0'
                }
            ]
        )
开发者ID:openstack,项目名称:fuel-web,代码行数:92,代码来源:test_plugin_adapters.py

示例12: setUp

# 需要导入模块: from nailgun.objects import Plugin [as 别名]
# 或者: from nailgun.objects.Plugin import create [as 别名]
 def setUp(self):
     super(TestClusterCompatiblityValidation, self).setUp()
     self.plugin = Plugin.create(self.env.get_default_plugin_metadata())
     self.attr_plugin = attr_plugin.ClusterAttributesPlugin(self.plugin)
开发者ID:Zipfer,项目名称:fuel-web,代码行数:6,代码来源:test_attributes_plugin.py


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