'Completely removes a cluster.'

@args('--recursive', action='store_true', default=False, help='Delete    associated    hosts.')
@args('binary', type=str, help='Service    to    delete    from    the    cluster.')
@args('cluster-name', type=str, help='Cluster    to    delete.')
def remove(self, recursive, binary, cluster_name):

    ctxt = context.get_admin_context()
    try:
        cluster = objects.Cluster.get_by_id(ctxt, None, name=cluster_name, binary=binary, get_services=recursive)
    except exception.ClusterNotFound:
        print((_("Couldn't    remove    cluster    %s    because    it    doesn't    exist.") % cluster_name))
        return 2
    if recursive:
        for service in cluster.services:
            service.destroy()
    try:
        cluster.destroy()
    except exception.ClusterHasHosts:
        print((_("Couldn't    remove    cluster    %s    because    it    still    has    hosts.") % cluster_name))
        return 2
    msg = (_('Cluster    %s    successfully    removed.') % cluster_name)
    if recursive:
        msg = (_('%(msg)s    And    %(num)s    services    from    the    cluster    were    also    removed.') % {'msg': msg, 'num': len(cluster.services)})
    print(msg)
