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


Python receiver.NailgunReceiver类代码示例

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


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

示例1: test_delete_non_default_node_group_reset_node_to_error

 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,代码行数:33,代码来源:test_node_groups.py

示例2: test_stop_provisioning

    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)
开发者ID:ogelbukh,项目名称:fuel-web,代码行数:27,代码来源:test_stop_deployment.py

示例3: test_success_action_with_plugins

 def test_success_action_with_plugins(self):
     NailgunReceiver._success_action(self.task, 'ready', 100)
     self.assertRegexpMatches(
         self.task.message,
         "Deployment of environment '[^\s]+' is done. "
         "\n\n"
         "Plugin name\d is deployed. description\d\n"
         "Plugin name\d is deployed. description\d")
开发者ID:dnikishov,项目名称:fuel-web,代码行数:8,代码来源:test_receiver.py

示例4: test_task_in_orchestrator_status_not_changed

 def test_task_in_orchestrator_status_not_changed(self):
     resp = {'task_uuid': self.task.uuid}
     for status in (consts.TASK_STATUSES.error,
                    consts.TASK_STATUSES.running,
                    consts.TASK_STATUSES.ready):
         self.task.status = status
         self.db.flush()
         NailgunReceiver.task_in_orchestrator(**resp)
         self.assertEqual(status, self.task.status)
开发者ID:dnikishov,项目名称:fuel-web,代码行数:9,代码来源:test_receiver.py

示例5: test_success_action_with_plugins

 def test_success_action_with_plugins(self):
     NailgunReceiver._success_action(self.task, 'ready', 100)
     self.assertRegexpMatches(
         self.task.message,
         "Deployment of environment '[^\s]+' is done. Access the OpenStack "
         "dashboard \(Horizon\) at [^\s]+\n"
         "\n"
         "Plugin name\d is deployed. description\d\n"
         "Plugin name\d is deployed. description\d")
开发者ID:naveenzhang,项目名称:fuel-web,代码行数:9,代码来源:test_receiver.py

示例6: test_multiline_error_message

 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,代码行数:10,代码来源:test_receiver.py

示例7: test_transaction_resp_update_transaction_status

 def test_transaction_resp_update_transaction_status(self, _):
     task = self.env.create_task(
         name=consts.TASK_NAMES.deployment,
         status=consts.TASK_STATUSES.running,
         cluster_id=self.cluster.id
     )
     NailgunReceiver.transaction_resp(
         task_uuid=task.uuid,
         status=consts.TASK_STATUSES.ready
     )
     self.db.refresh(task)
     self.assertEqual(consts.TASK_STATUSES.ready, task.status)
开发者ID:openstack,项目名称:fuel-web,代码行数:12,代码来源:test_receiver.py

示例8: test_check_repositories_resp_success

    def test_check_repositories_resp_success(self, update_verify_networks):
        repo_check_message = {
            "status": "ready",
            "progress": 100,
            "task_uuid": self.task.uuid,
            "nodes": [{
                "status": 0,
                "err": "",
                "out": "",
                "uid": "1"}]}
        NailgunReceiver.check_repositories_resp(**repo_check_message)

        update_verify_networks.assert_called_with(
            self.task, 'ready', 100, '', [])
开发者ID:mba811,项目名称:fuel-web,代码行数:14,代码来源:test_receiver.py

示例9: test_notify_provision_sub_task

 def test_notify_provision_sub_task(self, notify_checker):
     sub_task = self.env.create_task(
         name=consts.TASK_NAMES.provision,
         status=consts.TASK_STATUSES.ready,
         cluster_id=self.cluster.id,
         parent_id=self.task.id
     )
     NailgunReceiver._notify(
         sub_task,
         "done",
         "Test error.",
         "123",
         sub_task.uuid
     )
     self.assertEqual(0, notify_checker.call_count)
开发者ID:dnikishov,项目名称:fuel-web,代码行数:15,代码来源:test_receiver.py

示例10: test_notify_deployment

 def test_notify_deployment(self, notify_checker):
     NailgunReceiver._notify(
         self.task,
         "done",
         "Test error.",
         "123",
         self.task.uuid
     )
     notify_checker.assert_called_with(
         "done",
         u'Test error.',
         self.task.cluster_id,
         node_id="123",
         task_uuid=self.task.uuid
     )
开发者ID:dnikishov,项目名称:fuel-web,代码行数:15,代码来源:test_receiver.py

示例11: test_master_uid_in_deploy_resp

    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,代码行数:16,代码来源:test_receiver.py

示例12: test_check_repositories_resp_error

    def test_check_repositories_resp_error(self, update_verify_networks):
        urls = ['url1', 'url2']
        repo_check_message = {
            "status": "ready",
            "progress": 100,
            "task_uuid": self.task.uuid,
            "nodes": [{
                "status": 1,
                "out": {"failed_urls": urls},
                "err": "",
                "uid": "1"}]}
        NailgunReceiver.check_repositories_resp(**repo_check_message)

        update_verify_networks.assert_called_with(
            self.task, 'error', 100,
            ('These nodes: "1" failed to '
             'connect to some of these repositories: "url1", "url2"'), [])
开发者ID:kansuke4649,项目名称:fuel-web,代码行数:17,代码来源:test_receiver.py

示例13: test_config_execute_fails_if_deployment_running

    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,代码行数:18,代码来源:test_openstack_config_task_manager.py

示例14: test_stop_deployment

    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,代码行数:44,代码来源:test_stop_deployment.py

示例15: test_transaction_resp_update_node_attributes

 def test_transaction_resp_update_node_attributes(self):
     task = self.env.create_task(
         name=consts.TASK_NAMES.deployment,
         status=consts.TASK_STATUSES.running,
         cluster_id=self.cluster.id
     )
     node = self.cluster.nodes[0]
     node.status = consts.NODE_STATUSES.provisioned
     node.progress = 1
     node.pending_addition = True
     NailgunReceiver.transaction_resp(
         task_uuid=task.uuid,
         nodes=[{
             'uid': node.uid, 'progress': 50, 'pending_addition': False
         }]
     )
     self.db.refresh(node)
     self.assertEqual(50, node.progress)
     self.assertFalse(node.pending_addition)
开发者ID:openstack,项目名称:fuel-web,代码行数:19,代码来源:test_receiver.py


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