Пример #1
0
 def get_plugin_attributes(cls, cluster):
     plugins_attrs = {}
     for plugin_db in PluginCollection.all_newest():
         attr_plugin = wrap_plugin(plugin_db)
         attrs = attr_plugin.get_plugin_attributes(cluster)
         plugins_attrs.update(attrs)
     return plugins_attrs
Пример #2
0
 def get_cluster_plugins_with_tasks(cls, cluster):
     attr_plugins = []
     for plugin_db in cluster.plugins:
         attr_pl = wrap_plugin(plugin_db)
         attr_pl.set_cluster_tasks(cluster)
         attr_plugins.append(attr_pl)
     return attr_plugins
Пример #3
0
 def get_cluster_plugins_with_tasks(cls, cluster):
     attr_plugins = []
     for plugin_db in cluster.plugins:
         attr_pl = wrap_plugin(plugin_db)
         attr_pl.set_cluster_tasks(cluster)
         attr_plugins.append(attr_pl)
     return attr_plugins
Пример #4
0
 def get_plugin_attributes(cls, cluster):
     plugins_attrs = {}
     for plugin_db in PluginCollection.all_newest():
         attr_plugin = wrap_plugin(plugin_db)
         attrs = attr_plugin.get_plugin_attributes(cluster)
         plugins_attrs.update(attrs)
     return plugins_attrs
Пример #5
0
 def setUp(self):
     super(TestPrePostHooks, self).setUp()
     resp = self.create_plugin()
     self.plugin = attr_plugin.wrap_plugin(
         objects.Plugin.get_by_uid(resp.json['id']))
     self.cluster = self.create_cluster([
         {'roles': ['controller'], 'pending_addition': True},
         {'roles': ['compute'], 'pending_addition': True}])
     self.enable_plugin(self.cluster, self.sample_plugin['name'])
Пример #6
0
    def sync_plugins_metadata(cls, plugin_ids=None):
        """Sync metadata for plugins by given ids. If there is not
        ids all newest plugins will be synced
        """
        if plugin_ids:
            plugins = PluginCollection.get_by_uids(plugin_ids)
        else:
            plugins = PluginCollection.all_newest()

        for plugin in plugins:
            plugin_wrapper = wrap_plugin(plugin)
            plugin_wrapper.sync_metadata_to_db()
Пример #7
0
    def sync_plugins_metadata(cls, plugin_ids=None):
        """Sync metadata for plugins by given ids. If there is not
        ids all newest plugins will be synced
        """
        if plugin_ids:
            plugins = PluginCollection.get_by_uids(plugin_ids)
        else:
            plugins = PluginCollection.all_newest()

        for plugin in plugins:
            plugin_wrapper = wrap_plugin(plugin)
            plugin_wrapper.sync_metadata_to_db()
Пример #8
0
    def setUp(self):
        super(TestPrePostHooks, self).setUp()

        self._requests_mock = mock.patch(
            "nailgun.utils.debian.requests.get", return_value=mock.Mock(text="Archive: test")
        )
        self._requests_mock.start()

        resp = self.create_plugin()
        self.plugin = attr_plugin.wrap_plugin(objects.Plugin.get_by_uid(resp.json["id"]))
        self.cluster = self.create_cluster(
            [{"roles": ["controller"], "pending_addition": True}, {"roles": ["compute"], "pending_addition": True}]
        )
        self.enable_plugin(self.cluster, self.sample_plugin["name"])
Пример #9
0
    def setUp(self):
        super(TestPrePostHooks, self).setUp()

        self._requests_mock = mock.patch(
            'nailgun.utils.debian.requests.get',
            return_value=mock.Mock(text='Archive: test'))
        self._requests_mock.start()

        resp = self.create_plugin()
        self.plugin = attr_plugin.wrap_plugin(
            objects.Plugin.get_by_uid(resp.json['id']))
        self.cluster = self.create_cluster([
            {'roles': ['controller'], 'pending_addition': True},
            {'roles': ['compute'], 'pending_addition': True}])
        self.enable_plugin(self.cluster, self.sample_plugin['name'])
Пример #10
0
    def setUp(self):
        super(TestPrePostHooks, self).setUp()

        self._requests_mock = mock.patch(
            'nailgun.utils.debian.requests.get',
            return_value=mock.Mock(text='Archive: test'))
        self._requests_mock.start()

        resp = self.create_plugin()
        self.plugin = attr_plugin.wrap_plugin(
            objects.Plugin.get_by_uid(resp.json['id']))
        self.cluster = self.create_cluster([
            {'roles': ['controller'], 'pending_addition': True},
            {'roles': ['compute'], 'pending_addition': True}])
        self.enable_plugin(self.cluster, self.sample_plugin['name'])
Пример #11
0
    def setUp(self):
        super(TestPluginBase, self).setUp()
        self.plugin_metadata = self.env.get_default_plugin_metadata(
            package_version=self.package_version)
        self.plugin = Plugin.create(self.plugin_metadata)
        self.env.create(
            cluster_kwargs={'mode': 'multinode'},
            release_kwargs={
                'version': '2014.2-6.0',
                'operating_system': 'Ubuntu'})
        self.cluster = self.env.clusters[0]
        self.attr_plugin = attr_plugin.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()
Пример #12
0
    def setUp(self):
        super(TestPluginBase, self).setUp()
        self.plugin_metadata = self.env.get_default_plugin_metadata(
            package_version=self.package_version)
        self.plugin = Plugin.create(self.plugin_metadata)
        self.env.create(cluster_kwargs={'mode': 'multinode'},
                        release_kwargs={
                            'version': '2014.2-6.0',
                            'operating_system': 'Ubuntu'
                        })
        self.cluster = self.env.clusters[0]
        self.attr_plugin = attr_plugin.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()