def _serialize(self, cluster, nodes): if objects.Release.is_lcm_supported(cluster.release): raise self.http( 405, msg="The plugin hooks are not supported anymore." ) graph = orchestrator_graph.AstuteGraph(cluster) return post_deployment_serialize(graph, cluster, nodes)
def test_plugin_depl_task_in_post_depl(self): self.prepare_plugins_for_cluster( self.cluster, [ { 'name': 'post-depl-plugin-task', 'deployment_tasks': [ { 'id': 'post-depl-plugin-task', 'type': 'puppet', 'role': ['primary-controller'], 'requires': ['post_deployment_start'], 'required_for': ['post_deployment_end'], 'parameters': { 'puppet_manifest': 'post_depl_plugin_task', 'puppet_modules': 'test', 'timeout': 0, } }, ], }, ] ) graph = AstuteGraph(self.cluster) objects.NodeCollection.prepare_for_deployment(self.cluster.nodes) post_deployment = stages.post_deployment_serialize( graph, self.cluster, self.cluster.nodes) self.assertEqual( post_deployment[0]['parameters']['puppet_manifest'], 'post_depl_plugin_task' )
def message(cls, task, nodes, deployment_tasks=None): logger.debug("DeploymentTask.message(task=%s)" % task.uuid) deployment_tasks = deployment_tasks or [] nodes_ids = [n.id for n in nodes] for n in db().query(Node).filter_by( cluster=task.cluster).order_by(Node.id): if n.id in nodes_ids: if n.pending_roles: n.roles += n.pending_roles n.pending_roles = [] # If reciever for some reasons didn't update # node's status to provisioned when deployment # started, we should do it in nailgun if n.status in (consts.NODE_STATUSES.deploying,): n.status = consts.NODE_STATUSES.provisioned n.progress = 0 db().add(n) db().flush() orchestrator_graph = deployment_graph.AstuteGraph(task.cluster) orchestrator_graph.only_tasks(deployment_tasks) #NOTE(dshulyak) At this point parts of the orchestration can be empty, # it should not cause any issues with deployment/progress and was # done by design serialized_cluster = deployment_serializers.serialize( orchestrator_graph, task.cluster, nodes) pre_deployment = stages.pre_deployment_serialize( orchestrator_graph, task.cluster, nodes) post_deployment = stages.post_deployment_serialize( orchestrator_graph, task.cluster, nodes) # After serialization set pending_addition to False for node in nodes: node.pending_addition = False rpc_message = make_astute_message( task, cls._get_deployment_method(task.cluster), 'deploy_resp', { 'deployment_info': serialized_cluster, 'pre_deployment': pre_deployment, 'post_deployment': post_deployment } ) db().flush() return rpc_message
def message(cls, task, nodes, deployment_tasks=None): logger.debug("DeploymentTask.message(task=%s)" % task.uuid) deployment_tasks = deployment_tasks or [] nodes_ids = [n.id for n in nodes] for n in db().query(Node).filter_by( cluster=task.cluster).order_by(Node.id): if n.id in nodes_ids: if n.pending_roles: n.roles += n.pending_roles n.pending_roles = [] # If reciever for some reasons didn't update # node's status to provisioned when deployment # started, we should do it in nailgun if n.status in (consts.NODE_STATUSES.deploying,): n.status = consts.NODE_STATUSES.provisioned n.progress = 0 db().add(n) db().flush() orchestrator_graph = deployment_graph.AstuteGraph(task.cluster) orchestrator_graph.only_tasks(deployment_tasks) #NOTE(dshulyak) At this point parts of the orchestration can be empty, # it should not cause any issues with deployment/progress and was # done by design serialized_cluster = deployment_serializers.serialize( orchestrator_graph, task.cluster, nodes) pre_deployment = stages.pre_deployment_serialize( orchestrator_graph, task.cluster, nodes) post_deployment = stages.post_deployment_serialize( orchestrator_graph, task.cluster, nodes) # After serialization set pending_addition to False for node in nodes: node.pending_addition = False rpc_message = make_astute_message( task, cls._get_deployment_method(task.cluster), 'deploy_resp', { 'deployment_info': serialized_cluster, 'pre_deployment': pre_deployment, 'post_deployment': post_deployment } ) db().flush() return rpc_message
def _serialize(self, cluster, nodes): if objects.Release.is_lcm_supported(cluster.release): raise self.http(405, msg="The plugin hooks are not supported anymore.") graph = orchestrator_graph.AstuteGraph(cluster) return post_deployment_serialize(graph, cluster, nodes)
def _serialize(self, cluster, nodes): graph = deployment_graph.AstuteGraph(cluster) return post_deployment_serialize(graph, cluster, nodes)
def _serialize(self, cluster, nodes): graph = deployment_graph.AstuteGraph(cluster) return post_deployment_serialize(graph, cluster, nodes)