本文整理汇总了Python中nailgun.objects.ClusterPlugins.set_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python ClusterPlugins.set_attributes方法的具体用法?Python ClusterPlugins.set_attributes怎么用?Python ClusterPlugins.set_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.ClusterPlugins
的用法示例。
在下文中一共展示了ClusterPlugins.set_attributes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [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)
示例2: test_is_plugin_used
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [as 别名]
def test_is_plugin_used(self):
self._create_test_plugins()
cluster = self._create_test_cluster()
plugin = ClusterPlugins.get_connected_plugins(cluster).first()
self.assertFalse(ClusterPlugins.is_plugin_used(plugin.id))
ClusterPlugins.set_attributes(cluster.id, plugin.id, enabled=True)
self.assertTrue(ClusterPlugins.is_plugin_used(plugin.id))
示例3: test_get_enabled
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [as 别名]
def test_get_enabled(self):
self._create_test_plugins()
cluster = self._create_test_cluster()
plugin = ClusterPlugins.get_connected_plugins(cluster).first()
ClusterPlugins.set_attributes(cluster.id, plugin.id, enabled=True)
enabled_plugin = ClusterPlugins.get_enabled(cluster.id).first()
self.assertEqual(plugin.id, enabled_plugin.id)
示例4: test_get_enabled
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [as 别名]
def test_get_enabled(self):
self._create_test_plugins()
cluster = self._create_test_cluster()
plugin_id = ClusterPlugins.get_connected_plugins(cluster.id)[0][0]
ClusterPlugins.set_attributes(cluster.id, plugin_id, enabled=True)
enabled_plugin = ClusterPlugins.get_enabled(cluster.id)[0].id
self.assertEqual(enabled_plugin, plugin_id)
示例5: test_get_enabled_plugins
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [as 别名]
def test_get_enabled_plugins(self):
plugin_a = self._create_plugin(**self._compat_meta)
plugin_b = self._create_plugin(**self._compat_meta)
ClusterPlugins.set_attributes(
self.cluster.id, plugin_a.id, enabled=True)
compat_plugins = ClusterPlugins.get_compatible_plugins(self.cluster)
self.assertItemsEqual(compat_plugins, [plugin_a, plugin_b])
enabled_plugins = ClusterPlugins.get_enabled(self.cluster.id)
self.assertItemsEqual(enabled_plugins, [plugin_a])
示例6: test_set_plugin_attributes
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import set_attributes [as 别名]
def test_set_plugin_attributes(self):
meta = base.reflect_db_metadata()
self._create_test_plugins()
cluster = self._create_test_cluster()
plugin = ClusterPlugins.get_connected_plugins(cluster).first()
ClusterPlugins.set_attributes(cluster.id, plugin.id, enabled=True)
columns = meta.tables['cluster_plugins'].c
enabled = self.db.execute(
sa.select([columns.enabled])
.where(columns.cluster_id == cluster.id)
.where(columns.plugin_id == plugin.id)
).fetchone()
self.assertTrue(enabled[0])