List all available package upgrades on this system

    refresh
        force a refresh if set to True (default).
        If set to False it depends on zypper if a refresh is
        executed.

    root
        operate on a different root directory.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades

def list_upgrades(refresh=True, root=None, **kwargs):
    '''
    List all available package upgrades on this system

    refresh
        force a refresh if set to True (default).
        If set to False it depends on zypper if a refresh is
        executed.

    root
        operate on a different root directory.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    '''
    if refresh:
        refresh_db(root)

    ret = dict()
    cmd = ['list-updates']
    if 'fromrepo' in kwargs:
        repo_name = kwargs['fromrepo']
        if not isinstance(repo_name, six.string_types):
            repo_name = six.text_type(repo_name)
        cmd.extend(['--repo', repo_name])
    for update_node in __zypper__(root=root).nolock.xml.call(*cmd).getElementsByTagName('update'):
        if update_node.getAttribute('kind') == 'package':
            ret[update_node.getAttribute('name')] = update_node.getAttribute('edition')

    return ret