本文整理汇总了Python中nailgun.rpc.receiver.NailgunReceiver.provision_resp方法的典型用法代码示例。如果您正苦于以下问题:Python NailgunReceiver.provision_resp方法的具体用法?Python NailgunReceiver.provision_resp怎么用?Python NailgunReceiver.provision_resp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.rpc.receiver.NailgunReceiver
的用法示例。
在下文中一共展示了NailgunReceiver.provision_resp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stop_provisioning
# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import provision_resp [as 别名]
def test_stop_provisioning(self, _):
provision_task = self.env.launch_provisioning_selected(
self.node_uids
)
provision_task_uuid = provision_task.uuid
NailgunReceiver.provision_resp(
task_uuid=provision_task.uuid,
status=consts.TASK_STATUSES.running,
progress=50,
)
stop_task = self.env.stop_deployment()
NailgunReceiver.stop_deployment_resp(
task_uuid=stop_task.uuid,
status=consts.TASK_STATUSES.ready,
progress=100,
nodes=[{'uid': n.uid} for n in self.env.nodes],
)
self.assertEqual(stop_task.status, consts.TASK_STATUSES.ready)
self.assertTrue(self.db().query(Task).filter_by(
uuid=provision_task_uuid
).first())
self.assertIsNone(objects.Task.get_by_uuid(provision_task_uuid))
self.assertEqual(self.cluster.status, consts.CLUSTER_STATUSES.stopped)
self.assertEqual(stop_task.progress, 100)
self.assertFalse(self.cluster.is_locked)
示例2: test_deletion_during_deployment
# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import provision_resp [as 别名]
def test_deletion_during_deployment(self, mock_rpc):
self.env.create(
cluster_kwargs={
"name": u"Вася"
},
nodes_kwargs=[
{"status": "ready", "pending_addition": True},
]
)
cluster_id = self.env.clusters[0].id
resp = self.app.put(
reverse(
'ClusterChangesHandler',
kwargs={'cluster_id': cluster_id}),
headers=self.default_headers
)
deploy_uuid = resp.json_body['uuid']
NailgunReceiver.provision_resp(
task_uuid=deploy_uuid,
status=consts.TASK_STATUSES.running,
progress=50,
)
resp = self.app.delete(
reverse(
'ClusterHandler',
kwargs={'obj_id': cluster_id}),
headers=self.default_headers
)
task_delete = self.db.query(models.Task).filter_by(
uuid=resp.json['uuid']
).first()
NailgunReceiver.remove_cluster_resp(
task_uuid=task_delete.uuid,
status=consts.TASK_STATUSES.ready,
progress=100,
)
cluster = self.db.query(models.Cluster).filter_by(
id=cluster_id).first()
self.assertIsNone(cluster)