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


Python NailgunReceiver.deploy_resp方法代码示例

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


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

示例1: test_delete_non_default_node_group_reset_node_to_error

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
 def test_delete_non_default_node_group_reset_node_to_error(
         self, _, notify):
     node_group = self.env.create_node_group(api=False,
                                             cluster_id=self.cluster.id)
     self.env._create_network_group(cluster=self.cluster,
                                    group_id=node_group.id)
     node2 = self.env.create_node(group_id=node_group.id,
                                  roles=['compute'],
                                  status=consts.NODE_STATUSES.provisioned,
                                  cluster_id=self.cluster.id,
                                  ip='10.3.0.42')
     task = self.env.launch_deployment()
     NailgunReceiver.deploy_resp(
         task_uuid=task.uuid,
         status=consts.TASK_STATUSES.ready,
         progress=100,
         nodes=[{'uid': n.uid, 'status': consts.NODE_STATUSES.ready,
                 'progress': 100}
                for n in self.env.nodes],
     )
     reset_task = self.env.reset_environment()
     NailgunReceiver.reset_environment_resp(
         task_uuid=reset_task.uuid,
         status=consts.TASK_STATUSES.ready,
         progress=100,
         nodes=[{'uid': n.uid}
                for n in self.env.nodes],
     )
     self.env.delete_node_group(node_group.id)
     self.assertEqual(node2.status, consts.NODE_STATUSES.error)
     self.assertEqual(node2.error_type, consts.NODE_ERRORS.discover)
     self.assertIsNone(node2.cluster)
     notify.assert_called()
开发者ID:openstack,项目名称:fuel-web,代码行数:35,代码来源:test_node_groups.py

示例2: test_multiline_error_message

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
 def test_multiline_error_message(self, mnotify):
     task_resp = {
         "status": "error",
         "task_uuid": self.task.uuid,
         "error": "Method granular_deploy.\n\n Something Something"}
     NailgunReceiver.deploy_resp(**task_resp)
     mnotify.assert_called_with(
         task_resp['status'],
         u'Deployment has failed. Method granular_deploy.',
         self.cluster.id)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:12,代码来源:test_receiver.py

示例3: test_master_uid_in_deploy_resp

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
    def test_master_uid_in_deploy_resp(self):
        node_resp = {
            "task_uuid": self.task.uuid,
            "nodes": [
                {"status": "error", "hook": None, "error_type": "deploy",
                 "role": "hook", "uid": "master"}]}
        NailgunReceiver.deploy_resp(**node_resp)
        self.assertEqual(self.task.status, 'error')

        task_resp = {
            "status": "error",
            "task_uuid": self.task.uuid,
            "error": "Method granular_deploy."}
        NailgunReceiver.deploy_resp(**task_resp)
        self.assertEqual(self.task.status, 'error')
        self.assertIn(task_resp['error'], self.task.message)
开发者ID:dnikishov,项目名称:fuel-web,代码行数:18,代码来源:test_receiver.py

示例4: test_config_execute_fails_if_deployment_running

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
    def test_config_execute_fails_if_deployment_running(self, mocked_rpc):
        task_manager = OpenstackConfigTaskManager(self.cluster.id)
        task = task_manager.execute({'cluster_id': self.cluster.id})

        self.assertEqual(task.status, consts.TASK_STATUSES.pending)

        NailgunReceiver.deploy_resp(
            task_uuid=task.uuid,
            status=consts.TASK_STATUSES.running,
            progress=50,
            nodes=[{'uid': n.uid, 'status': consts.NODE_STATUSES.ready}
                   for n in self.env.nodes],
        )

        self.assertEqual(task.status, consts.TASK_STATUSES.running)
        task2 = OpenstackConfigTaskManager(self.cluster.id)
        self.assertRaises(errors.TaskAlreadyRunning,
                          task2.execute, {'cluster_id': self.cluster.id})
开发者ID:huyupeng,项目名称:fuel-web,代码行数:20,代码来源:test_openstack_config_task_manager.py

示例5: test_stop_deployment

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
    def test_stop_deployment(self):
        supertask = self.env.launch_deployment()
        self.assertEqual(supertask.status, consts.TASK_STATUSES.pending)

        deploy_task = [t for t in supertask.subtasks
                       if t.name in (consts.TASK_NAMES.deployment)][0]

        NailgunReceiver.deploy_resp(
            task_uuid=deploy_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=deploy_task.uuid
        ).first())
        self.assertIsNone(objects.Task.get_by_uuid(deploy_task.uuid))

        self.assertEqual(self.cluster.status,
                         consts.CLUSTER_STATUSES.stopped)
        self.assertEqual(stop_task.progress, 100)
        self.assertFalse(self.cluster.is_locked)

        for n in self.cluster.nodes:
            self.assertEqual(n.roles, [])
            self.assertNotEqual(n.pending_roles, [])

        notification = self.db.query(Notification).filter_by(
            cluster_id=stop_task.cluster_id
        ).order_by(
            Notification.datetime.desc()
        ).first()
        self.assertRegexpMatches(
            notification.message,
            'was successfully stopped')
开发者ID:huyupeng,项目名称:fuel-web,代码行数:46,代码来源:test_stop_deployment.py

示例6: test_stop_deployment_fail_if_deployed_before

# 需要导入模块: from nailgun.rpc.receiver import NailgunReceiver [as 别名]
# 或者: from nailgun.rpc.receiver.NailgunReceiver import deploy_resp [as 别名]
    def test_stop_deployment_fail_if_deployed_before(self):
        task = self.env.launch_deployment()

        deploy_task = [t for t in task.subtasks
                       if t.name == consts.TASK_NAMES.deployment][0]

        # In objects/task.py cluster status is set to operational. Cluster
        # function __update_cluster_status checks if nodes are in
        # expected_node_status, and if they are - then
        # set_deployed_before_flag is set. This flag is used to determine if
        # cluster was ever deployed before.
        NailgunReceiver.deploy_resp(
            task_uuid=deploy_task.uuid,
            status=consts.TASK_STATUSES.ready,
            progress=100,
            nodes=[{'uid': n.uid, 'status': consts.NODE_STATUSES.ready}
                   for n in self.env.nodes],
        )
        # If we don't send 'ready' for main task, then redeploy can't be
        # started - as we still have deployment running
        # TODO(mihgen): investigate why DeploymentAlreadyStarted is unhandled
        NailgunReceiver.deploy_resp(
            task_uuid=task.uuid,
            status=consts.TASK_STATUSES.ready,
        )

        # changes to deploy
        self.env.create_node(
            cluster_id=self.cluster.id,
            roles=["controller"],
            pending_addition=True
        )

        supertask = self.env.launch_deployment()
        redeploy_task = [t for t in supertask.subtasks
                         if t.name == consts.TASK_NAMES.deployment][0]
        NailgunReceiver.deploy_resp(
            task_uuid=redeploy_task.uuid,
            status=consts.TASK_STATUSES.running,
            progress=50,
        )

        # stop task will not be created as in this situation
        # the error will be raised by validator thus we cannot use
        # self.env.stop_deployment to check the result
        resp = self.app.put(
            reverse(
                'ClusterStopDeploymentHandler',
                kwargs={'cluster_id': self.cluster.id}),
            expect_errors=True,
            headers=self.default_headers
        )

        self.assertEqual(resp.status_code, 400)
        self.assertEqual(resp.json_body['message'],
                         'Stop action is forbidden for the cluster. Current '
                         'deployment process is running on a pre-deployed '
                         'cluster that does not support LCM.')
开发者ID:huyupeng,项目名称:fuel-web,代码行数:60,代码来源:test_stop_deployment.py


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