Add the given overlay from the cached remote list to your locally
    installed overlays. Specify 'ALL' to add all overlays from the
    remote list.

    Return a list of the new overlay(s) added:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.add <overlay name>

def add(overlay):
    '''
    Add the given overlay from the cached remote list to your locally
    installed overlays. Specify 'ALL' to add all overlays from the
    remote list.

    Return a list of the new overlay(s) added:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.add <overlay name>
    '''
    ret = list()
    old_overlays = list_local()
    cmd = 'layman --quietness=0 --add {0}'.format(overlay)
    add_attempt = __salt__['cmd.run_all'](cmd, python_shell=False, stdin='y')
    if add_attempt['retcode'] != 0:
        raise salt.exceptions.CommandExecutionError(add_attempt['stdout'])
    new_overlays = list_local()

    # If we did not have any overlays before and we successfully added
    # a new one. We need to ensure the make.conf is sourcing layman's
    # make.conf so emerge can see the overlays
    if not old_overlays and new_overlays:
        srcline = 'source /var/lib/layman/make.conf'
        makeconf = _get_makeconf()
        if not __salt__['file.contains'](makeconf, 'layman'):
            __salt__['file.append'](makeconf, srcline)

    ret = [overlay for overlay in new_overlays if overlay not in old_overlays]
    return ret