def cluster_delete(self, context, uuid):
    LOG.debug('cluster_conductor cluster_delete')
    osc = clients.OpenStackClients(context)
    cluster = objects.Cluster.get_by_uuid(context, uuid)
    ct = conductor_utils.retrieve_cluster_template(context, cluster)
    cluster_driver = driver.Driver.get_driver(ct.server_type, ct.cluster_distro, ct.coe)
    try:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_PENDING)
        cluster_driver.delete_cluster(context, cluster)
        cluster.status = fields.ClusterStatus.DELETE_IN_PROGRESS
        cluster.status_reason = None
    except exc.HTTPNotFound:
        LOG.info(('The cluster %s was not found during cluster deletion.' % cluster.id))
        try:
            trust_manager.delete_trustee_and_trust(osc, context, cluster)
            cert_manager.delete_certificates_from_cluster(cluster, context=context)
            cluster.destroy()
        except exception.ClusterNotFound:
            LOG.info(('The cluster %s has been deleted by others.' % uuid))
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_SUCCESS)
        return None
    except exc.HTTPConflict:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_FAILURE)
        raise exception.OperationInProgress(cluster_name=cluster.name)
    except Exception as unexp:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_FAILURE)
        cluster.status = fields.ClusterStatus.DELETE_FAILED
        cluster.status_reason = six.text_type(unexp)
        cluster.save()
        raise
    cluster.save()
    return None
def cluster_delete(self, context, uuid):
    LOG.debug('cluster_conductor cluster_delete')
    osc = clients.OpenStackClients(context)
    cluster = objects.Cluster.get_by_uuid(context, uuid)
    ct = conductor_utils.retrieve_cluster_template(context, cluster)
    cluster_driver = driver.Driver.get_driver(ct.server_type, ct.cluster_distro, ct.coe)
    try:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_PENDING)
        cluster_driver.delete_cluster(context, cluster)
        cluster.status = fields.ClusterStatus.DELETE_IN_PROGRESS
        cluster.status_reason = None
    except exc.HTTPNotFound:
        LOG.info(('The cluster %s was not found during cluster deletion.' % cluster.id))
        try:
            trust_manager.delete_trustee_and_trust(osc, context, cluster)
            cert_manager.delete_certificates_from_cluster(cluster, context=context)
            cluster.destroy()
        except exception.ClusterNotFound:
            LOG.info(('The cluster %s has been deleted by others.' % uuid))
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_SUCCESS)
        return None
    except exc.HTTPConflict:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_FAILURE)
        raise exception.OperationInProgress(cluster_name=cluster.name)
    except Exception as unexp:
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_FAILURE)
        cluster.status = fields.ClusterStatus.DELETE_FAILED
        cluster.status_reason = six.text_type(unexp)
        cluster.save()
        raise
    cluster.save()
    return None