Deletes a key from etcd

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.

    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive delete.

    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001

def rm(name, recurse=False, profile=None, **kwargs):
    '''
    Deletes a key from etcd

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.

    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive delete.

    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001
    '''

    rtn = {
        'name': name,
        'result': True,
        'changes': {}
    }

    if not __salt__['etcd.get'](name, profile=profile, **kwargs):
        rtn['comment'] = 'Key does not exist'
        return rtn

    if __salt__['etcd.rm'](name, recurse=recurse, profile=profile, **kwargs):
        rtn['comment'] = 'Key removed'
        rtn['changes'] = {
            name: 'Deleted'
        }
    else:
        rtn['comment'] = 'Unable to remove key'

    return rtn