Exemplo n.º 1
0
    def extract_steps_from_deployment_update(self, deployment_update):
        supported_steps, unsupported_steps = \
            step_extractor.extract_steps(deployment_update)

        if not unsupported_steps:
            for step in supported_steps:
                self.create_deployment_update_step(
                    deployment_update_id=deployment_update.id,
                    action=step.action,
                    entity_type=step.entity_type,
                    entity_id=step.entity_id,
                )

        # if there are unsupported steps, raise an exception telling the user
        # about these unsupported steps
        else:
            deployment_update.state = STATES.FAILED
            self.sm.update(deployment_update)
            unsupported_entity_ids = [step.entity_id
                                      for step in unsupported_steps]
            raise \
                manager_exceptions.UnsupportedChangeInDeploymentUpdate(
                    'The blueprint you provided for the deployment update '
                    'contains changes currently unsupported by the deployment '
                    'update mechanism.\n'
                    'Unsupported changes: {0}'
                    .format('\n'.join(unsupported_entity_ids)))
Exemplo n.º 2
0
    def extract_steps_from_deployment_update(self, deployment_update_id):

        deployment_update = self.get_deployment_update(deployment_update_id)

        supported_steps, unsupported_steps = \
            step_extractor.extract_steps(deployment_update)

        if not unsupported_steps:
            deployment_update.steps = [
                self.convert_step_to_model_step(step)
                for step in supported_steps
            ]

            self.sm.update_entity(deployment_update)

        # if there are unsupported steps, raise an exception telling the user
        # about these unsupported steps
        else:
            deployment_update.state = STATES.FAILED
            self.sm.update_entity(deployment_update)
            unsupported_entity_ids = [
                step.entity_id for step in unsupported_steps
            ]
            raise \
                manager_exceptions.UnsupportedChangeInDeploymentUpdate(
                    'The blueprint you provided for the deployment update '
                    'contains changes currently unsupported by the deployment '
                    'update mechanism.\n'
                    'Unsupported changes: {0}'
                    .format('\n'.join(unsupported_entity_ids)))

        return self.get_deployment_update(deployment_update_id)
Exemplo n.º 3
0
    def extract_steps_from_deployment_update(self, deployment_update):
        supported_steps, unsupported_steps = step_extractor.extract_steps(
            deployment_update)

        if unsupported_steps:
            deployment_update.state = STATES.FAILED
            self.sm.update(deployment_update)
            unsupported_entity_ids = [
                step.entity_id for step in unsupported_steps
            ]
            raise manager_exceptions.UnsupportedChangeInDeploymentUpdate(
                'The blueprint you provided for the deployment update '
                'contains changes currently unsupported by the deployment '
                'update mechanism.\n'
                'Unsupported changes: {0}'.format(
                    '\n'.join(unsupported_entity_ids)))

        for step in supported_steps:
            self.create_deployment_update_step(deployment_update, step.action,
                                               step.entity_type,
                                               step.entity_id)