Remove a cluster admin or a database user.

    If a database is specified: it will remove the database user.
    If a database is not specified: it will remove the cluster admin.

    name
        User name to remove

    database
        The database to remove the user from

    user
        User name for the new user to delete

    user
        The user to connect as

    password
        The password of the user

    host
        The host to connect to

    port
        The port to connect to

    CLI Example:

    .. code-block:: bash

        salt '*' influxdb08.user_remove <name>
        salt '*' influxdb08.user_remove <name> <database>
        salt '*' influxdb08.user_remove <name> <database> <user> <password> <host> <port>

def user_remove(name,
                database=None,
                user=None,
                password=None,
                host=None,
                port=None):
    '''
    Remove a cluster admin or a database user.

    If a database is specified: it will remove the database user.
    If a database is not specified: it will remove the cluster admin.

    name
        User name to remove

    database
        The database to remove the user from

    user
        User name for the new user to delete

    user
        The user to connect as

    password
        The password of the user

    host
        The host to connect to

    port
        The port to connect to

    CLI Example:

    .. code-block:: bash

        salt '*' influxdb08.user_remove <name>
        salt '*' influxdb08.user_remove <name> <database>
        salt '*' influxdb08.user_remove <name> <database> <user> <password> <host> <port>
    '''
    if not user_exists(name, database, user, password, host, port):
        if database:
            log.info('User \'%s\' does not exist for DB \'%s\'', name, database)
        else:
            log.info('Cluster admin \'%s\' does not exist', name)
        return False

    client = _client(user=user, password=password, host=host, port=port)

    if not database:
        return client.delete_cluster_admin(name)

    client.switch_database(database)
    return client.delete_database_user(name)