Esempio n. 1
0
    def post_delete(self):

        utils.unassign_runtime_property_from_resource(constants.ZONE,
                                                      ctx.instance)
        super(Ebs, self).post_delete()

        return True
Esempio n. 2
0
    def post_delete(self):

        utils.unassign_runtime_property_from_resource(
                constants.ZONE, ctx.instance)
        super(Ebs, self).post_delete()

        return True
Esempio n. 3
0
    def post_disassociate(self):

        super(VolumeInstanceConnection, self).post_disassociate()
        utils.unassign_runtime_property_from_resource('instance_id',
                                                      ctx.source.instance)

        return True
Esempio n. 4
0
    def post_disassociate(self):

        super(VolumeInstanceConnection, self).post_disassociate()
        utils.unassign_runtime_property_from_resource(
            'instance_id', ctx.source.instance)

        return True
Esempio n. 5
0
    def post_disassociate(self):

        super(VolumeInstanceConnection, self).post_disassociate()
        utils.unassign_runtime_property_from_resource('instance_id',
                                                      ctx.source.instance)
        device = \
            ctx.source.instance.runtime_properties.pop('device', None)
        ctx.target.instance.runtime_properties.pop('{0}-device'.format(device),
                                                   None)

        return True
Esempio n. 6
0
    def post_disassociate(self):

        ctx.logger.info(
            'Volume {0} is assumed to be disassociated from instance {1}.'
            .format(self.source_resource_id,
                    self.target_resource_id))
        utils.unassign_runtime_property_from_resource(
            'instance_id', ctx.source.instance)
        device = \
            ctx.source.instance.runtime_properties.pop('device', None)
        ctx.target.instance.runtime_properties.pop(
            '{0}-device'.format(device), None)

        return True
Esempio n. 7
0
    def delete(self, args=None, **_):

        instance_id = self.resource_id

        try:
            self.execute(self.client.terminate_instances,
                         dict(instance_ids=instance_id),
                         raise_on_falsy=True)
        except (exception.EC2ResponseError, exception.BotoServerError) as e:
            raise NonRecoverableError('{0}'.format(str(e)))

        if self._get_instance_state() == \
                constants.INSTANCE_STATE_TERMINATED:
            ctx.logger.info('Terminated instance: {0}.'.format(instance_id))
            utils.unassign_runtime_property_from_resource(
                constants.EXTERNAL_RESOURCE_ID, ctx.instance)
            return True
        return False
Esempio n. 8
0
    def delete(self, args=None, **_):
        """This releases an Elastic IP created by Cloudify
        in the connected account.
        """

        address_object = self.get_resource()

        if not address_object:
            raise NonRecoverableError(
                    'Unable to release elasticip. Elasticip not in account.')

        delete_args = dict(public_ip=self.resource_id)
        if constants.ELASTICIP['VPC_DOMAIN'] in address_object.domain:
            delete_args.update(
                {
                    'public_ip': None,
                    constants.ELASTICIP[
                     'ALLOCATION_ID']: str(address_object.allocation_id)
                }
            )
        delete_args = utils.update_args(delete_args, args)

        try:
            deleted = self.execute(self.client.release_address,
                                   delete_args, raise_on_falsy=True)
        except (exception.EC2ResponseError,
                exception.BotoServerError) as e:
            raise NonRecoverableError('{0}'.format(str(e)))

        if not deleted:
            raise NonRecoverableError(
                    'Elastic IP {0} deletion failed for an unknown reason.'
                    .format(address_object.public_ip))

        address = self.get_resource()

        if not address:
            utils.unassign_runtime_property_from_resource(
                    constants.ELASTICIP['ALLOCATION_ID'], ctx.instance)
        else:
            return False

        return True
Esempio n. 9
0
    def delete(self, args=None, **_):

        instance_id = self.resource_id

        try:
            self.execute(self.client.terminate_instances,
                         dict(instance_ids=instance_id),
                         raise_on_falsy=True)
        except (exception.EC2ResponseError,
                exception.BotoServerError) as e:
            raise NonRecoverableError('{0}'.format(str(e)))

        if self._get_instance_state() == \
                constants.INSTANCE_STATE_TERMINATED:
            ctx.logger.info('Terminated instance: {0}.'.format(instance_id))
            utils.unassign_runtime_property_from_resource(
                    constants.EXTERNAL_RESOURCE_ID, ctx.instance)
            return True
        return False
Esempio n. 10
0
    def delete(self, args=None, **_):
        """This releases an Elastic IP created by Cloudify
        in the connected account.
        """

        address_object = self.get_resource()

        if not address_object:
            raise NonRecoverableError(
                'Unable to release elasticip. Elasticip not in account.')

        delete_args = dict(public_ip=self.resource_id)
        if constants.ELASTICIP['VPC_DOMAIN'] in address_object.domain:
            delete_args.update({
                'public_ip':
                None,
                constants.ELASTICIP['ALLOCATION_ID']:
                str(address_object.allocation_id)
            })
        delete_args = utils.update_args(delete_args, args)

        try:
            deleted = self.execute(self.client.release_address,
                                   delete_args,
                                   raise_on_falsy=True)
        except (exception.EC2ResponseError, exception.BotoServerError) as e:
            raise NonRecoverableError('{0}'.format(str(e)))

        if not deleted:
            raise NonRecoverableError(
                'Elastic IP {0} deletion failed for an unknown reason.'.format(
                    address_object.public_ip))

        address = self.get_resource()

        if not address:
            utils.unassign_runtime_property_from_resource(
                constants.ELASTICIP['ALLOCATION_ID'], ctx.instance)
        else:
            return False

        return True
Esempio n. 11
0
    def post_disassociate(self):
        super(ElasticIPInstanceConnection, self).post_disassociate()
        utils.unassign_runtime_property_from_resource(
                'public_ip_address', ctx.source.instance)
        utils.unassign_runtime_property_from_resource(
                'instance_id', ctx.target.instance)
        if ctx.source.instance.runtime_properties.get('vpc_id'):
            utils.unassign_runtime_property_from_resource(
                'vpc_id', ctx.target.instance)

        return True
Esempio n. 12
0
    def post_disassociate(self):
        super(ElasticIPInstanceConnection, self).post_disassociate()
        utils.unassign_runtime_property_from_resource('public_ip_address',
                                                      ctx.source.instance)
        utils.unassign_runtime_property_from_resource('instance_id',
                                                      ctx.target.instance)
        if ctx.source.instance.runtime_properties.get('vpc_id'):
            utils.unassign_runtime_property_from_resource(
                'vpc_id', ctx.target.instance)

        return True
 def post_disassociate(self):
     utils.unassign_runtime_property_from_resource('association_id',
                                                   ctx.source.instance)
Esempio n. 14
0
 def post_disassociate(self):
     utils.unassign_runtime_property_from_resource(
         'vpc_id', ctx.source.instance)