本文整理汇总了Python中nailgun.task.helpers.TaskHelper.nodes_to_delete方法的典型用法代码示例。如果您正苦于以下问题:Python TaskHelper.nodes_to_delete方法的具体用法?Python TaskHelper.nodes_to_delete怎么用?Python TaskHelper.nodes_to_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.task.helpers.TaskHelper
的用法示例。
在下文中一共展示了TaskHelper.nodes_to_delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deploy_shrink_controllers
# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_delete [as 别名]
def test_deploy_shrink_controllers(self):
cluster = self.create_env(
nodes_kwargs=[
{'roles': ['controller']},
{'roles': ['controller'], 'pending_deletion': True},
{'roles': ['controller'], 'pending_deletion': True}])
# Check that we are deleting 2 controllers
d_nodes = TaskHelper.nodes_to_delete(cluster)
self.assertEqual(len(d_nodes), 2)
supertask = self.env.launch_deployment()
self.assertEqual(supertask.name, consts.TASK_NAMES.deploy)
self.assertNotEqual(supertask.status, consts.TASK_STATUSES.error)
controllers = self.filter_by_role(cluster.nodes, 'controller')
self.assertEqual(len(controllers), 1)
示例2: test_deletion_offline_node
# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_delete [as 别名]
def test_deletion_offline_node(self):
self.env.create(
nodes_kwargs=[
{"online": False, "pending_deletion": True},
{"status": "ready"}
]
)
to_delete = TaskHelper.nodes_to_delete(self.env.clusters[0])
to_delete_ids = [node.id for node in to_delete]
self.assertEqual(len(to_delete_ids), 1)
supertask = self.env.launch_deployment()
self.env.wait_ready(supertask, timeout=5)
self.assertEqual(self.env.db.query(models.Node).count(), 1)
remaining_node = self.env.db.query(models.Node).first()
self.assertNotIn(remaining_node.id, to_delete_ids)
示例3: test_deploy_shrink_controllers
# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_delete [as 别名]
def test_deploy_shrink_controllers(self):
cluster = self.create_env(
nodes_kwargs=[
{'roles': ['controller']},
{'roles': ['controller'], 'pending_deletion': True},
{'roles': ['controller'], 'pending_deletion': True}])
# Check that we are deleting 2 controllers
d_nodes = TaskHelper.nodes_to_delete(cluster)
self.assertEquals(len(d_nodes), 2)
supertask = self.env.launch_deployment()
self.assertEquals(supertask.name, 'deploy')
self.env.wait_ready(supertask)
self.assertEquals(supertask.status, 'ready')
controllers = self.filter_by_role(cluster.nodes, 'controller')
self.assertEquals(len(controllers), 1)
示例4: test_deploy_shrink_controllers
# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_delete [as 别名]
def test_deploy_shrink_controllers(self):
cluster = self.create_env(
nodes_kwargs=[
{"roles": ["controller"]},
{"roles": ["controller"], "pending_deletion": True},
{"roles": ["controller"], "pending_deletion": True},
]
)
# Check that we are deleting 2 controllers
d_nodes = TaskHelper.nodes_to_delete(cluster)
self.assertEqual(len(d_nodes), 2)
supertask = self.env.launch_deployment()
self.assertEqual(supertask.name, "deploy")
self.env.wait_ready(supertask)
self.assertEqual(supertask.status, "ready")
controllers = self.filter_by_role(cluster.nodes, "controller")
self.assertEqual(len(controllers), 1)
示例5: get_task_nodes_for_cluster
# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_delete [as 别名]
def get_task_nodes_for_cluster(cls, cluster):
return cls.prepare_nodes_for_task(TaskHelper.nodes_to_delete(cluster))