• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python receiver.NailgunReceiver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_deletion_during_deployment

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


示例17: test_notify_deployment_sub_task

 def test_notify_deployment_sub_task(self, notify_checker):
     sub_task = self.env.create_task(
         name=consts.TASK_NAMES.deployment,
         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
     )
     notify_checker.assert_called_with(
         "done",
         u'Test error.',
         sub_task.cluster_id,
         node_id="123",
         task_uuid=sub_task.uuid
     )
开发者ID:dnikishov,项目名称:fuel-web,代码行数:21,代码来源:test_receiver.py


示例18: test_transaction_resp_does_not_fail_on_virtual_nodes

    def test_transaction_resp_does_not_fail_on_virtual_nodes(self):
        task = self.env.create_task(
            name=consts.TASK_NAMES.deployment,
            status=consts.TASK_STATUSES.running,
            cluster_id=self.cluster.id,
            dry_run=True
        )

        NailgunReceiver.transaction_resp(
            task_uuid=task.uuid,
            status=consts.TASK_STATUSES.running,
            nodes=[
                {
                    'uid': consts.MASTER_NODE_UID,
                    'status': consts.NODE_STATUSES.provisioned,
                },
                {
                    # cluster node uid is null
                    'uid': None,
                    'status': consts.NODE_STATUSES.provisioned,
                },
            ])
开发者ID:openstack,项目名称:fuel-web,代码行数:22,代码来源:test_receiver.py


示例19: test_stop_deployment_fail_if_deployed_before

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


示例20: test_transaction_resp_does_not_update_nodes_if_dry_run

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python installation_info.InstallationInfo类代码示例发布时间:2022-05-27
下一篇:
Python rpc.cast函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap