Install all available updates. Returns a dictionary containing the name
    of the update and the status of its installation.

    :param bool recommended: If set to True, only install the recommended
        updates. If set to False (default) all updates are installed.

    :param bool restart: Set this to False if you do not want to install updates
        that require a restart. Default is True

    :return: A dictionary containing the updates that were installed and the
        status of its installation. If no updates were installed an empty
        dictionary is returned.

    :rtype: dict

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.update_all

def update_all(recommended=False, restart=True):
    '''
    Install all available updates. Returns a dictionary containing the name
    of the update and the status of its installation.

    :param bool recommended: If set to True, only install the recommended
        updates. If set to False (default) all updates are installed.

    :param bool restart: Set this to False if you do not want to install updates
        that require a restart. Default is True

    :return: A dictionary containing the updates that were installed and the
        status of its installation. If no updates were installed an empty
        dictionary is returned.

    :rtype: dict

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.update_all
    '''
    to_update = _get_available(recommended, restart)

    if not to_update:
        return {}

    for _update in to_update:
        cmd = ['softwareupdate', '--install', _update]
        salt.utils.mac_utils.execute_return_success(cmd)

    ret = {}
    updates_left = _get_available()

    for _update in to_update:
        ret[_update] = True if _update not in updates_left else False

    return ret