Updated patch

e9
Erik Johnson 9 years ago
parent 5893bcc3b3
commit a484eec981

@ -7,7 +7,7 @@ index 25b26f0..91258a3 100644
''' '''
-Support for YUM -Support for YUM
+Support for YUM/DNF +Support for YUM/DNF
.. note:: .. note::
- This module makes heavy use of the **repoquery** utility, from the - This module makes heavy use of the **repoquery** utility, from the
- yum-utils_ package. This package will be installed as a dependency if salt - yum-utils_ package. This package will be installed as a dependency if salt
@ -17,14 +17,14 @@ index 25b26f0..91258a3 100644
+ installed via EPEL. However, if salt has been installed using pip, or a + installed via EPEL. However, if salt has been installed using pip, or a
host is being managed using salt-ssh, then as of version 2014.7.0 host is being managed using salt-ssh, then as of version 2014.7.0
yum-utils_ will be installed automatically to satisfy this dependency. yum-utils_ will be installed automatically to satisfy this dependency.
+ DNF is fully supported as of version 2015.5.10 and 2015.8.4 (partial + DNF is fully supported as of version 2015.5.10 and 2015.8.4 (partial
+ support for DNF was initially added in 2015.8.0), and DNF is used + support for DNF was initially added in 2015.8.0), and DNF is used
+ automatically in place of YUM in Fedora 22 and newer. For these versions, + automatically in place of YUM in Fedora 22 and newer. For these versions,
+ repoquery is available from the ``dnf-plugins-core`` package. + repoquery is available from the ``dnf-plugins-core`` package.
+ +
.. _yum-utils: http://yum.baseurl.org/wiki/YumUtils .. _yum-utils: http://yum.baseurl.org/wiki/YumUtils
''' '''
@@ -16,16 +21,18 @@ Support for YUM @@ -16,16 +21,18 @@ Support for YUM
# Import python libs # Import python libs
@ -37,7 +37,7 @@ index 25b26f0..91258a3 100644
import re import re
+import string +import string
from distutils.version import LooseVersion as _LooseVersion # pylint: disable=no-name-in-module,import-error from distutils.version import LooseVersion as _LooseVersion # pylint: disable=no-name-in-module,import-error
# Import 3rd-party libs # Import 3rd-party libs
# pylint: disable=import-error,redefined-builtin # pylint: disable=import-error,redefined-builtin
-import salt.ext.six as six -import salt.ext.six as six
@ -45,7 +45,7 @@ index 25b26f0..91258a3 100644
-from salt.ext.six.moves import shlex_quote as _cmd_quote, range -from salt.ext.six.moves import shlex_quote as _cmd_quote, range
+from salt.ext import six +from salt.ext import six
+from salt.ext.six.moves import zip +from salt.ext.six.moves import zip
try: try:
import yum import yum
@@ -39,36 +46,20 @@ try: @@ -39,36 +46,20 @@ try:
@ -54,7 +54,7 @@ index 25b26f0..91258a3 100644
HAS_RPMUTILS = False HAS_RPMUTILS = False
-# pylint: enable=import-error -# pylint: enable=import-error
+# pylint: enable=import-error,redefined-builtin +# pylint: enable=import-error,redefined-builtin
# Import salt libs # Import salt libs
import salt.utils import salt.utils
+import salt.utils.itertools +import salt.utils.itertools
@ -63,9 +63,9 @@ index 25b26f0..91258a3 100644
from salt.exceptions import ( from salt.exceptions import (
CommandExecutionError, MinionError, SaltInvocationError CommandExecutionError, MinionError, SaltInvocationError
) )
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
-__QUERYFORMAT = '%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-%{REPOID}' -__QUERYFORMAT = '%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-%{REPOID}'
- -
-# These arches compiled from the rpmUtils.arch python module source -# These arches compiled from the rpmUtils.arch python module source
@ -86,13 +86,13 @@ index 25b26f0..91258a3 100644
-__ARCHES = __ARCHES_64 + __ARCHES_32 + __ARCHES_PPC + __ARCHES_S390 + \ -__ARCHES = __ARCHES_64 + __ARCHES_32 + __ARCHES_PPC + __ARCHES_S390 + \
- __ARCHES_ALPHA + __ARCHES_ARM + __ARCHES_SH - __ARCHES_ALPHA + __ARCHES_ARM + __ARCHES_SH
+__HOLD_PATTERN = r'\w+(?:[.-][^-]+)*' +__HOLD_PATTERN = r'\w+(?:[.-][^-]+)*'
# Define the module's virtual name # Define the module's virtual name
__virtualname__ = 'pkg' __virtualname__ = 'pkg'
@@ -93,32 +84,63 @@ def __virtual__(): @@ -93,32 +84,63 @@ def __virtual__():
return False return False
-def _parse_pkginfo(line): -def _parse_pkginfo(line):
- ''' - '''
- A small helper to parse a repoquery; returns a namedtuple - A small helper to parse a repoquery; returns a namedtuple
@ -122,7 +122,7 @@ index 25b26f0..91258a3 100644
- ) - )
+ Resolve a package name from a line containing the hold expression. If the + Resolve a package name from a line containing the hold expression. If the
+ regex is not matched, None is returned. + regex is not matched, None is returned.
- try: - try:
- name, pkg_version, release, arch, repoid = line.split('_|-') - name, pkg_version, release, arch, repoid = line.split('_|-')
- # Handle unpack errors (should never happen with the queryformat we are - # Handle unpack errors (should never happen with the queryformat we are
@ -152,13 +152,13 @@ index 25b26f0..91258a3 100644
+ else: + else:
+ return match.group(1) + return match.group(1)
+ return None + return None
- if not _check_32(arch): - if not _check_32(arch):
- if arch not in (__grains__['osarch'], 'noarch'): - if arch not in (__grains__['osarch'], 'noarch'):
- name += '.{0}'.format(arch) - name += '.{0}'.format(arch)
- if release: - if release:
- pkg_version += '-{0}'.format(release) - pkg_version += '-{0}'.format(release)
- return pkginfo(name, pkg_version, arch, repoid) - return pkginfo(name, pkg_version, arch, repoid)
+def _yum(): +def _yum():
+ ''' + '''
@ -172,8 +172,8 @@ index 25b26f0..91258a3 100644
+ else: + else:
+ __context__[contextkey] = 'yum' + __context__[contextkey] = 'yum'
+ return __context__[contextkey] + return __context__[contextkey]
def _repoquery_pkginfo(repoquery_args): def _repoquery_pkginfo(repoquery_args):
@@ -126,8 +148,11 @@ def _repoquery_pkginfo(repoquery_args): @@ -126,8 +148,11 @@ def _repoquery_pkginfo(repoquery_args):
Wrapper to call repoquery and parse out all the tuples Wrapper to call repoquery and parse out all the tuples
@ -307,8 +307,8 @@ index 25b26f0..91258a3 100644
- # Check again now that we've installed yum-utils - # Check again now that we've installed yum-utils
- if not salt.utils.which('repoquery'): - if not salt.utils.which('repoquery'):
- raise CommandExecutionError('Unable to install yum-utils') - raise CommandExecutionError('Unable to install yum-utils')
-def _repoquery(repoquery_args, query_format=__QUERYFORMAT): -def _repoquery(repoquery_args, query_format=__QUERYFORMAT):
+def _repoquery(repoquery_args, +def _repoquery(repoquery_args,
+ query_format=salt.utils.pkg.rpm.QUERYFORMAT, + query_format=salt.utils.pkg.rpm.QUERYFORMAT,
@ -346,13 +346,13 @@ index 25b26f0..91258a3 100644
- out = call['stdout'] - out = call['stdout']
- return out.splitlines() - return out.splitlines()
+ return call['stdout'].splitlines() + return call['stdout'].splitlines()
def _get_repo_options(**kwargs): def _get_repo_options(**kwargs):
@@ -187,20 +315,38 @@ def _get_repo_options(**kwargs): @@ -187,20 +315,38 @@ def _get_repo_options(**kwargs):
if repo and not fromrepo: if repo and not fromrepo:
fromrepo = repo fromrepo = repo
- repo_arg = '' - repo_arg = ''
+ use_dnf_repoquery = kwargs.get('repoquery', False) and _yum() == 'dnf' + use_dnf_repoquery = kwargs.get('repoquery', False) and _yum() == 'dnf'
+ ret = [] + ret = []
@ -395,8 +395,8 @@ index 25b26f0..91258a3 100644
+ log.info('Enabling repo \'%s\'', enablerepo) + log.info('Enabling repo \'%s\'', enablerepo)
+ ret.append('--enablerepo={0}'.format(enablerepo)) + ret.append('--enablerepo={0}'.format(enablerepo))
+ return ret + return ret
def _get_excludes_option(**kwargs): def _get_excludes_option(**kwargs):
@@ -208,14 +354,18 @@ def _get_excludes_option(**kwargs): @@ -208,14 +354,18 @@ def _get_excludes_option(**kwargs):
Returns a string of '--disableexcludes' option to be used in the yum command, Returns a string of '--disableexcludes' option to be used in the yum command,
@ -404,7 +404,7 @@ index 25b26f0..91258a3 100644
''' '''
- disable_excludes_arg = '' - disable_excludes_arg = ''
disable_excludes = kwargs.get('disableexcludes', '') disable_excludes = kwargs.get('disableexcludes', '')
if disable_excludes: if disable_excludes:
- log.info('Disabling excludes for {0!r}'.format(disable_excludes)) - log.info('Disabling excludes for {0!r}'.format(disable_excludes))
- disable_excludes_arg = ('--disableexcludes={0!r}'.format(disable_excludes)) - disable_excludes_arg = ('--disableexcludes={0!r}'.format(disable_excludes))
@ -419,13 +419,13 @@ index 25b26f0..91258a3 100644
+ log.info('Disabling excludes for \'%s\'', disable_excludes) + log.info('Disabling excludes for \'%s\'', disable_excludes)
+ return ['--disableexcludes=\'{0}\''.format(disable_excludes)] + return ['--disableexcludes=\'{0}\''.format(disable_excludes)]
+ return [] + return []
def _get_branch_option(**kwargs): def _get_branch_option(**kwargs):
@@ -226,45 +376,11 @@ def _get_branch_option(**kwargs): @@ -226,45 +376,11 @@ def _get_branch_option(**kwargs):
# Get branch option from the kwargs # Get branch option from the kwargs
branch = kwargs.get('branch', '') branch = kwargs.get('branch', '')
- branch_arg = '' - branch_arg = ''
+ ret = [] + ret = []
if branch: if branch:
@ -469,20 +469,20 @@ index 25b26f0..91258a3 100644
+ log.info('Adding branch \'%s\'', branch) + log.info('Adding branch \'%s\'', branch)
+ ret.append('--branch=\'{0}\''.format(branch)) + ret.append('--branch=\'{0}\''.format(branch))
+ return ret + return ret
def _get_yum_config(): def _get_yum_config():
@@ -275,9 +391,9 @@ def _get_yum_config(): @@ -275,9 +391,9 @@ def _get_yum_config():
This is currently only used to get the reposdir settings, but could be used This is currently only used to get the reposdir settings, but could be used
for other things if needed. for other things if needed.
- If the yum python library is available, use that, which will give us - If the yum python library is available, use that, which will give us
- all of the options, including all of the defaults not specified in the - all of the options, including all of the defaults not specified in the
- yum config. Additionally, they will all be of the correct object type. - yum config. Additionally, they will all be of the correct object type.
+ If the yum python library is available, use that, which will give us all of + If the yum python library is available, use that, which will give us all of
+ the options, including all of the defaults not specified in the yum config. + the options, including all of the defaults not specified in the yum config.
+ Additionally, they will all be of the correct object type. + Additionally, they will all be of the correct object type.
If the yum library is not available, we try to read the yum.conf If the yum library is not available, we try to read the yum.conf
directly ourselves with a minimal set of "defaults". directly ourselves with a minimal set of "defaults".
@@ -291,7 +407,7 @@ def _get_yum_config(): @@ -291,7 +407,7 @@ def _get_yum_config():
@ -510,11 +510,11 @@ index 25b26f0..91258a3 100644
+ 'defaults', + 'defaults',
+ fn + fn
+ ) + )
return conf return conf
@@ -350,13 +471,13 @@ def _normalize_basedir(basedir=None): @@ -350,13 +471,13 @@ def _normalize_basedir(basedir=None):
Returns a list of directories. Returns a list of directories.
''' '''
- if basedir is None: - if basedir is None:
@ -524,7 +524,7 @@ index 25b26f0..91258a3 100644
- if isinstance(basedir, basestring): - if isinstance(basedir, basestring):
+ if isinstance(basedir, six.string_types): + if isinstance(basedir, six.string_types):
basedir = [x.strip() for x in basedir.split(',')] basedir = [x.strip() for x in basedir.split(',')]
+ if basedir is None: + if basedir is None:
+ basedir = [] + basedir = []
+ +
@ -545,7 +545,7 @@ index 25b26f0..91258a3 100644
+ or salt.utils.pkg.rpm.check_32(arch, osarch=__grains__['osarch']): + or salt.utils.pkg.rpm.check_32(arch, osarch=__grains__['osarch']):
return name[:-(len(arch) + 1)] return name[:-(len(arch) + 1)]
return name return name
@@ -423,25 +545,20 @@ def latest_version(*names, **kwargs): @@ -423,25 +545,20 @@ def latest_version(*names, **kwargs):
# Initialize the return dict with empty strings, and populate namearch_map. # Initialize the return dict with empty strings, and populate namearch_map.
# namearch_map will provide a means of distinguishing between multiple # namearch_map will provide a means of distinguishing between multiple
@ -580,7 +580,7 @@ index 25b26f0..91258a3 100644
@@ -454,19 +571,46 @@ def latest_version(*names, **kwargs): @@ -454,19 +571,46 @@ def latest_version(*names, **kwargs):
if refresh: if refresh:
refresh_db(**kwargs) refresh_db(**kwargs)
- # Get updates for specified package(s) - # Get updates for specified package(s)
- updates = _repoquery_pkginfo( - updates = _repoquery_pkginfo(
- '{0} {1} --pkgnarrow=available {2}' - '{0} {1} --pkgnarrow=available {2}'
@ -616,7 +616,7 @@ index 25b26f0..91258a3 100644
+ key=lambda pkginfo: _LooseVersion(pkginfo.version), + key=lambda pkginfo: _LooseVersion(pkginfo.version),
+ reverse=True + reverse=True
+ ) + )
for name in names: for name in names:
for pkg in (x for x in updates if x.name == name): for pkg in (x for x in updates if x.name == name):
if pkg.arch == 'noarch' or pkg.arch == namearch_map[name] \ if pkg.arch == 'noarch' or pkg.arch == namearch_map[name] \
@ -627,7 +627,7 @@ index 25b26f0..91258a3 100644
break break
+ else: + else:
+ ret[name] = '' + ret[name] = ''
# Return a string if only one package name passed # Return a string if only one package name passed
if len(names) == 1: if len(names) == 1:
@@ -533,8 +677,8 @@ def version_cmp(pkg1, pkg2): @@ -533,8 +677,8 @@ def version_cmp(pkg1, pkg2):
@ -643,7 +643,7 @@ index 25b26f0..91258a3 100644
# this for RHEL5, or if an exception is raised when attempting to compare # this for RHEL5, or if an exception is raised when attempting to compare
@@ -569,10 +713,20 @@ def list_pkgs(versions_as_list=False, **kwargs): @@ -569,10 +713,20 @@ def list_pkgs(versions_as_list=False, **kwargs):
return ret return ret
ret = {} ret = {}
- for pkginfo in _repoquery_pkginfo('--all --pkgnarrow=installed'): - for pkginfo in _repoquery_pkginfo('--all --pkgnarrow=installed'):
- if pkginfo is None: - if pkginfo is None:
@ -663,13 +663,13 @@ index 25b26f0..91258a3 100644
+ __salt__['pkg_resource.add_pkg'](ret, + __salt__['pkg_resource.add_pkg'](ret,
+ pkginfo.name, + pkginfo.name,
+ pkginfo.version) + pkginfo.version)
__salt__['pkg_resource.sort_pkglist'](ret) __salt__['pkg_resource.sort_pkglist'](ret)
__context__['pkg.list_pkgs'] = copy.deepcopy(ret) __context__['pkg.list_pkgs'] = copy.deepcopy(ret)
@@ -593,6 +747,14 @@ def list_repo_pkgs(*args, **kwargs): @@ -593,6 +747,14 @@ def list_repo_pkgs(*args, **kwargs):
can be passed and the results will be filtered to packages matching those can be passed and the results will be filtered to packages matching those
names. This is recommended as it speeds up the function considerably. names. This is recommended as it speeds up the function considerably.
+ .. warning:: + .. warning::
+ Running this function on RHEL/CentOS 6 and earlier will be more + Running this function on RHEL/CentOS 6 and earlier will be more
+ resource-intensive, as the version of yum that ships with older + resource-intensive, as the version of yum that ships with older
@ -680,10 +680,10 @@ index 25b26f0..91258a3 100644
+ +
This function can be helpful in discovering the version or repo to specify This function can be helpful in discovering the version or repo to specify
in a :mod:`pkg.installed <salt.states.pkg.installed>` state. in a :mod:`pkg.installed <salt.states.pkg.installed>` state.
@@ -643,17 +805,70 @@ def list_repo_pkgs(*args, **kwargs): @@ -643,17 +805,70 @@ def list_repo_pkgs(*args, **kwargs):
) )
ret = {} ret = {}
- for repo in repos: - for repo in repos:
- repoquery_cmd = '--all --repoid="{0}" --show-duplicates'.format(repo) - repoquery_cmd = '--all --repoid="{0}" --show-duplicates'.format(repo)
@ -753,24 +753,24 @@ index 25b26f0..91258a3 100644
+ if out['retcode'] != 0 and 'Error:' in out['stdout']: + if out['retcode'] != 0 and 'Error:' in out['stdout']:
+ continue + continue
+ _parse_output(out['stdout']) + _parse_output(out['stdout'])
for reponame in ret: for reponame in ret:
+ # Sort versions newest to oldest + # Sort versions newest to oldest
for pkgname in ret[reponame]: for pkgname in ret[reponame]:
sorted_versions = sorted( sorted_versions = sorted(
[_LooseVersion(x) for x in ret[reponame][pkgname]], [_LooseVersion(x) for x in ret[reponame][pkgname]],
@@ -669,7 +884,8 @@ def list_upgrades(refresh=True, **kwargs): @@ -669,7 +884,8 @@ def list_upgrades(refresh=True, **kwargs):
The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are
supported, as used in pkg states, and the ``disableexcludes`` option is supported, as used in pkg states, and the ``disableexcludes`` option is
- also supported. - also supported.
+ also supported. However, in Fedora 22 and newer all of these but + also supported. However, in Fedora 22 and newer all of these but
+ ``fromrepo`` is ignored. + ``fromrepo`` is ignored.
.. versionadded:: 2014.7.0 .. versionadded:: 2014.7.0
Support for the ``disableexcludes`` option Support for the ``disableexcludes`` option
@@ -685,10 +901,19 @@ def list_upgrades(refresh=True, **kwargs): @@ -685,10 +901,19 @@ def list_upgrades(refresh=True, **kwargs):
if salt.utils.is_true(refresh): if salt.utils.is_true(refresh):
refresh_db(**kwargs) refresh_db(**kwargs)
- updates = _repoquery_pkginfo( - updates = _repoquery_pkginfo(
@ -790,17 +790,17 @@ index 25b26f0..91258a3 100644
+ return {} + return {}
+ +
+ return dict([(x.name, x.version) for x in _yum_pkginfo(out['stdout'])]) + return dict([(x.name, x.version) for x in _yum_pkginfo(out['stdout'])])
def check_db(*names, **kwargs): def check_db(*names, **kwargs):
@@ -705,7 +930,8 @@ def check_db(*names, **kwargs): @@ -705,7 +930,8 @@ def check_db(*names, **kwargs):
The ``fromrepo``, ``enablerepo`` and ``disablerepo`` arguments are The ``fromrepo``, ``enablerepo`` and ``disablerepo`` arguments are
supported, as used in pkg states, and the ``disableexcludes`` option is supported, as used in pkg states, and the ``disableexcludes`` option is
- also supported. - also supported.
+ also supported. However, in Fedora 22 and newer all of these but + also supported. However, in Fedora 22 and newer all of these but
+ ``fromrepo`` is ignored. + ``fromrepo`` is ignored.
.. versionadded:: 2014.7.0 .. versionadded:: 2014.7.0
Support for the ``disableexcludes`` option Support for the ``disableexcludes`` option
@@ -718,41 +944,44 @@ def check_db(*names, **kwargs): @@ -718,41 +944,44 @@ def check_db(*names, **kwargs):
@ -823,7 +823,7 @@ index 25b26f0..91258a3 100644
+ repoquery_base = repo_arg + exclude_arg + repoquery_base = repo_arg + exclude_arg
+ repoquery_base.extend(['--all', '--quiet', '--whatprovides']) + repoquery_base.extend(['--all', '--quiet', '--whatprovides'])
+ avail_cmd = repo_arg + ['--pkgnarrow=all', '--all'] + avail_cmd = repo_arg + ['--pkgnarrow=all', '--all']
if 'pkg._avail' in __context__: if 'pkg._avail' in __context__:
avail = __context__['pkg._avail'] avail = __context__['pkg._avail']
else: else:
@ -848,7 +848,7 @@ index 25b26f0..91258a3 100644
+ avail.add('.'.join((name, arch))) + avail.add('.'.join((name, arch)))
+ avail = sorted(avail) + avail = sorted(avail)
__context__['pkg._avail'] = avail __context__['pkg._avail'] = avail
ret = {} ret = {}
- if names: - if names:
- repoquery_cmd = repoquery_base + ' {0}'.format(" ".join(names)) - repoquery_cmd = repoquery_base + ' {0}'.format(" ".join(names))
@ -868,7 +868,7 @@ index 25b26f0..91258a3 100644
@@ -807,22 +1036,19 @@ def refresh_db(**kwargs): @@ -807,22 +1036,19 @@ def refresh_db(**kwargs):
exclude_arg = _get_excludes_option(**kwargs) exclude_arg = _get_excludes_option(**kwargs)
branch_arg = _get_branch_option(**kwargs) branch_arg = _get_branch_option(**kwargs)
- clean_cmd = 'yum -q clean expire-cache {repo} {exclude} {branch}'.format( - clean_cmd = 'yum -q clean expire-cache {repo} {exclude} {branch}'.format(
- repo=repo_arg, - repo=repo_arg,
- exclude=exclude_arg, - exclude=exclude_arg,
@ -885,7 +885,7 @@ index 25b26f0..91258a3 100644
+ if args: + if args:
+ clean_cmd.extend(args) + clean_cmd.extend(args)
+ update_cmd.extend(args) + update_cmd.extend(args)
- __salt__['cmd.run'](clean_cmd) - __salt__['cmd.run'](clean_cmd)
- return retcodes.get( - return retcodes.get(
- __salt__['cmd.retcode'](update_cmd, ignore_retcode=True), - __salt__['cmd.retcode'](update_cmd, ignore_retcode=True),
@ -897,13 +897,13 @@ index 25b26f0..91258a3 100644
+ ignore_retcode=True, + ignore_retcode=True,
+ python_shell=False) + python_shell=False)
+ return retcodes.get(result, False) + return retcodes.get(result, False)
def clean_metadata(**kwargs): def clean_metadata(**kwargs):
@@ -841,102 +1067,6 @@ def clean_metadata(**kwargs): @@ -841,102 +1067,6 @@ def clean_metadata(**kwargs):
return refresh_db(**kwargs) return refresh_db(**kwargs)
-def group_install(name, -def group_install(name,
- skip=(), - skip=(),
- include=(), - include=(),
@ -1006,16 +1006,16 @@ index 25b26f0..91258a3 100644
@@ -977,7 +1107,7 @@ def install(name=None, @@ -977,7 +1107,7 @@ def install(name=None,
``yum reinstall`` will only be used if the installed version ``yum reinstall`` will only be used if the installed version
matches the requested version. matches the requested version.
- Works with sources when the package header of the source can be - Works with sources when the package header of the source can be
+ Works with ``sources`` when the package header of the source can be + Works with ``sources`` when the package header of the source can be
matched to the name and version of an installed package. matched to the name and version of an installed package.
.. versionadded:: 2014.7.0 .. versionadded:: 2014.7.0
@@ -1037,19 +1167,17 @@ def install(name=None, @@ -1037,19 +1167,17 @@ def install(name=None,
salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]' salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
- normalize - normalize
- Normalize the package name by removing the architecture. Default is True. - Normalize the package name by removing the architecture. Default is True.
- This is useful for poorly created packages which might include the - This is useful for poorly created packages which might include the
@ -1028,17 +1028,17 @@ index 25b26f0..91258a3 100644
+ for poorly created packages which might include the architecture as an + for poorly created packages which might include the architecture as an
+ actual part of the name such as kernel modules which match a specific + actual part of the name such as kernel modules which match a specific
+ kernel version. + kernel version.
- Example: - Example:
+ .. code-block:: bash + .. code-block:: bash
- .. code-block:: bash - .. code-block:: bash
+ salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False + salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False
- salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False - salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False
+ .. versionadded:: 2014.7.0 + .. versionadded:: 2014.7.0
Returns a dict containing the new package names and versions:: Returns a dict containing the new package names and versions::
@@ -1093,36 +1221,48 @@ def install(name=None, @@ -1093,36 +1221,48 @@ def install(name=None,
else: else:
@ -1050,7 +1050,7 @@ index 25b26f0..91258a3 100644
- else: - else:
- pkg_params_items.append([pkg_source, None, pkg_source]) - pkg_params_items.append([pkg_source, None, pkg_source])
+ pkg_params_items.append([pkg_source]) + pkg_params_items.append([pkg_source])
for pkg_item_list in pkg_params_items: for pkg_item_list in pkg_params_items:
- pkgname = pkg_item_list[0] - pkgname = pkg_item_list[0]
- version_num = pkg_item_list[1] - version_num = pkg_item_list[1]
@ -1076,7 +1076,7 @@ index 25b26f0..91258a3 100644
+ pkgname = None + pkgname = None
+ pkgpath = pkg_item_list[0] + pkgpath = pkg_item_list[0]
+ version_num = None + version_num = None
+ if version_num is None: + if version_num is None:
+ if pkg_type == 'repository': + if pkg_type == 'repository':
+ if reinstall and pkgname in old: + if reinstall and pkgname in old:
@ -1114,7 +1114,7 @@ index 25b26f0..91258a3 100644
@@ -1137,47 +1277,63 @@ def install(name=None, @@ -1137,47 +1277,63 @@ def install(name=None,
else: else:
downgrade.append(pkgstr) downgrade.append(pkgstr)
+ def _add_common_args(cmd): + def _add_common_args(cmd):
+ ''' + '''
+ DRY function to add args common to all yum/dnf commands + DRY function to add args common to all yum/dnf commands
@ -1145,7 +1145,7 @@ index 25b26f0..91258a3 100644
+ redirect_stderr=True + redirect_stderr=True
) )
- __salt__['cmd.run'](cmd, output_loglevel='trace') - __salt__['cmd.run'](cmd, output_loglevel='trace')
if downgrade: if downgrade:
- cmd = 'yum -y {repo} {exclude} {branch} {gpgcheck} downgrade {pkg}'.format( - cmd = 'yum -y {repo} {exclude} {branch} {gpgcheck} downgrade {pkg}'.format(
- repo=repo_arg, - repo=repo_arg,
@ -1164,7 +1164,7 @@ index 25b26f0..91258a3 100644
+ redirect_stderr=True + redirect_stderr=True
) )
- __salt__['cmd.run'](cmd, output_loglevel='trace') - __salt__['cmd.run'](cmd, output_loglevel='trace')
if to_reinstall: if to_reinstall:
- cmd = 'yum -y {repo} {exclude} {branch} {gpgcheck} reinstall {pkg}'.format( - cmd = 'yum -y {repo} {exclude} {branch} {gpgcheck} reinstall {pkg}'.format(
- repo=repo_arg, - repo=repo_arg,
@ -1183,7 +1183,7 @@ index 25b26f0..91258a3 100644
+ redirect_stderr=True + redirect_stderr=True
) )
- __salt__['cmd.run'](cmd, output_loglevel='trace') - __salt__['cmd.run'](cmd, output_loglevel='trace')
__context__.pop('pkg.list_pkgs', None) __context__.pop('pkg.list_pkgs', None)
new = list_pkgs() new = list_pkgs()
+ +
@ -1203,7 +1203,7 @@ index 25b26f0..91258a3 100644
return ret return ret
@@ -1228,13 +1384,15 @@ def upgrade(refresh=True, skip_verify=False, **kwargs): @@ -1228,13 +1384,15 @@ def upgrade(refresh=True, skip_verify=False, **kwargs):
refresh_db(**kwargs) refresh_db(**kwargs)
old = list_pkgs() old = list_pkgs()
- cmd = 'yum -q -y {repo} {exclude} {branch} {gpgcheck} upgrade'.format( - cmd = 'yum -q -y {repo} {exclude} {branch} {gpgcheck} upgrade'.format(
- repo=repo_arg, - repo=repo_arg,
@ -1225,17 +1225,17 @@ index 25b26f0..91258a3 100644
new = list_pkgs() new = list_pkgs()
ret = salt.utils.compare_dicts(old, new) ret = salt.utils.compare_dicts(old, new)
@@ -1245,10 +1403,10 @@ def upgrade(refresh=True, skip_verify=False, **kwargs): @@ -1245,10 +1403,10 @@ def upgrade(refresh=True, skip_verify=False, **kwargs):
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613 def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613
''' '''
- Remove packages with ``yum -q -y remove``. - Remove packages with ``yum -q -y remove``.
+ Remove packages + Remove packages
name name
- The name of the package to be deleted. - The name of the package to be deleted.
+ The name of the package to be removed + The name of the package to be removed
Multiple Package Options: Multiple Package Options:
@@ -1279,8 +1437,7 @@ def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613 @@ -1279,8 +1437,7 @@ def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613
targets = [x for x in pkg_params if x in old] targets = [x for x in pkg_params if x in old]
@ -1249,17 +1249,17 @@ index 25b26f0..91258a3 100644
new = list_pkgs() new = list_pkgs()
@@ -1296,7 +1453,7 @@ def purge(name=None, pkgs=None, **kwargs): # pylint: disable=W0613 @@ -1296,7 +1453,7 @@ def purge(name=None, pkgs=None, **kwargs): # pylint: disable=W0613
:mod:`pkg.remove <salt.modules.yumpkg.remove>`. :mod:`pkg.remove <salt.modules.yumpkg.remove>`.
name name
- The name of the package to be deleted. - The name of the package to be deleted.
+ The name of the package to be purged + The name of the package to be purged
Multiple Package Options: Multiple Package Options:
@@ -1325,7 +1482,15 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 @@ -1325,7 +1482,15 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
''' '''
.. versionadded:: 2014.7.0 .. versionadded:: 2014.7.0
- Hold packages with ``yum -q versionlock``. - Hold packages with ``yum -q versionlock``.
+ Version-lock packages + Version-lock packages
+ +
@ -1270,7 +1270,7 @@ index 25b26f0..91258a3 100644
+ - On RHEL 6 & 7: ``yum-plugin-versionlock`` + - On RHEL 6 & 7: ``yum-plugin-versionlock``
+ - On Fedora: ``python-dnf-plugins-extras-versionlock`` + - On Fedora: ``python-dnf-plugins-extras-versionlock``
+ +
name name
The name of the package to be held. The name of the package to be held.
@@ -1345,13 +1510,8 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 @@ -1345,13 +1510,8 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
@ -1278,7 +1278,7 @@ index 25b26f0..91258a3 100644
salt '*' pkg.hold pkgs='["foo", "bar"]' salt '*' pkg.hold pkgs='["foo", "bar"]'
''' '''
+ _check_versionlock() + _check_versionlock()
- on_redhat_5 = __grains__.get('osmajorrelease', None) == '5' - on_redhat_5 = __grains__.get('osmajorrelease', None) == '5'
- lock_pkg = 'yum-versionlock' if on_redhat_5 else 'yum-plugin-versionlock' - lock_pkg = 'yum-versionlock' if on_redhat_5 else 'yum-plugin-versionlock'
- if lock_pkg not in list_pkgs(): - if lock_pkg not in list_pkgs():
@ -1289,7 +1289,7 @@ index 25b26f0..91258a3 100644
raise SaltInvocationError( raise SaltInvocationError(
'One of name, pkgs, or sources must be specified.' 'One of name, pkgs, or sources must be specified.'
@@ -1363,29 +1523,18 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 @@ -1363,29 +1523,18 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
targets = [] targets = []
if pkgs: if pkgs:
- for pkg in salt.utils.repack_dictlist(pkgs): - for pkg in salt.utils.repack_dictlist(pkgs):
@ -1310,7 +1310,7 @@ index 25b26f0..91258a3 100644
- 'Package {0} not available in repository.'.format(name) - 'Package {0} not available in repository.'.format(name)
- ) - )
targets.append(name) targets.append(name)
- current_locks = get_locked_packages(full=False) - current_locks = get_locked_packages(full=False)
+ current_locks = list_holds(full=False) + current_locks = list_holds(full=False)
ret = {} ret = {}
@ -1318,7 +1318,7 @@ index 25b26f0..91258a3 100644
if isinstance(target, dict): if isinstance(target, dict):
- target = next(iter(target)) - target = next(iter(target))
+ target = next(six.iterkeys(target)) + target = next(six.iterkeys(target))
ret[target] = {'name': target, ret[target] = {'name': target,
'changes': {}, 'changes': {},
@@ -1398,8 +1547,8 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 @@ -1398,8 +1547,8 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
@ -1329,13 +1329,13 @@ index 25b26f0..91258a3 100644
- out = __salt__['cmd.run_all'](cmd) - out = __salt__['cmd.run_all'](cmd)
+ cmd = [_yum(), 'versionlock', target] + cmd = [_yum(), 'versionlock', target]
+ out = __salt__['cmd.run_all'](cmd, python_shell=False) + out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] == 0: if out['retcode'] == 0:
ret[target].update(result=True) ret[target].update(result=True)
@@ -1421,10 +1570,18 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06 @@ -1421,10 +1570,18 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
''' '''
.. versionadded:: 2014.7.0 .. versionadded:: 2014.7.0
- Hold packages with ``yum -q versionlock``. - Hold packages with ``yum -q versionlock``.
+ Remove version locks + Remove version locks
+ +
@ -1346,19 +1346,19 @@ index 25b26f0..91258a3 100644
+ - On RHEL 6 & 7: ``yum-plugin-versionlock`` + - On RHEL 6 & 7: ``yum-plugin-versionlock``
+ - On Fedora: ``python-dnf-plugins-extras-versionlock`` + - On Fedora: ``python-dnf-plugins-extras-versionlock``
+ +
name name
- The name of the package to be deleted. - The name of the package to be deleted.
+ The name of the package to be unheld + The name of the package to be unheld
Multiple Package Options: Multiple Package Options:
@@ -1441,13 +1598,8 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06 @@ -1441,13 +1598,8 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
salt '*' pkg.unhold <package name> salt '*' pkg.unhold <package name>
salt '*' pkg.unhold pkgs='["foo", "bar"]' salt '*' pkg.unhold pkgs='["foo", "bar"]'
''' '''
+ _check_versionlock() + _check_versionlock()
- on_redhat_5 = __grains__.get('osmajorrelease', None) == '5' - on_redhat_5 = __grains__.get('osmajorrelease', None) == '5'
- lock_pkg = 'yum-versionlock' if on_redhat_5 else 'yum-plugin-versionlock' - lock_pkg = 'yum-versionlock' if on_redhat_5 else 'yum-plugin-versionlock'
- if lock_pkg not in list_pkgs(): - if lock_pkg not in list_pkgs():
@ -1371,7 +1371,7 @@ index 25b26f0..91258a3 100644
@@ -1467,30 +1619,43 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06 @@ -1467,30 +1619,43 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
else: else:
targets.append(name) targets.append(name)
- current_locks = get_locked_packages(full=True) - current_locks = get_locked_packages(full=True)
+ # Yum's versionlock plugin doesn't support passing just the package name + # Yum's versionlock plugin doesn't support passing just the package name
+ # when removing a lock, so we need to get the full list and then use + # when removing a lock, so we need to get the full list and then use
@ -1383,12 +1383,12 @@ index 25b26f0..91258a3 100644
if isinstance(target, dict): if isinstance(target, dict):
- target = next(iter(target)) - target = next(iter(target))
+ target = next(six.iterkeys(target)) + target = next(six.iterkeys(target))
ret[target] = {'name': target, ret[target] = {'name': target,
'changes': {}, 'changes': {},
'result': False, 'result': False,
'comment': ''} 'comment': ''}
- search_locks = [lock for lock in current_locks - search_locks = [lock for lock in current_locks
- if target in lock] - if target in lock]
+ if _yum() == 'dnf': + if _yum() == 'dnf':
@ -1419,13 +1419,13 @@ index 25b26f0..91258a3 100644
- out = __salt__['cmd.run_all'](cmd) - out = __salt__['cmd.run_all'](cmd)
+ cmd = [_yum(), 'versionlock', 'delete'] + search_locks + cmd = [_yum(), 'versionlock', 'delete'] + search_locks
+ out = __salt__['cmd.run_all'](cmd, python_shell=False) + out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] == 0: if out['retcode'] == 0:
ret[target].update(result=True) ret[target].update(result=True)
@@ -1508,45 +1673,47 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06 @@ -1508,45 +1673,47 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
return ret return ret
-def get_locked_packages(pattern=None, full=True): -def get_locked_packages(pattern=None, full=True):
- ''' - '''
- Get packages that are currently locked - Get packages that are currently locked
@ -1451,11 +1451,11 @@ index 25b26f0..91258a3 100644
+ Show the full hold definition including version and epoch. Set to + Show the full hold definition including version and epoch. Set to
+ ``False`` to return just the name of the package(s) being held. + ``False`` to return just the name of the package(s) being held.
+ +
CLI Example: CLI Example:
.. code-block:: bash .. code-block:: bash
- salt '*' pkg.get_locked_packages - salt '*' pkg.get_locked_packages
+ salt '*' pkg.list_holds + salt '*' pkg.list_holds
+ salt '*' pkg.list_holds full=False + salt '*' pkg.list_holds full=False
@ -1463,7 +1463,7 @@ index 25b26f0..91258a3 100644
- cmd = 'yum -q versionlock list' - cmd = 'yum -q versionlock list'
- ret = __salt__['cmd.run'](cmd).split('\n') - ret = __salt__['cmd.run'](cmd).split('\n')
+ _check_versionlock() + _check_versionlock()
- if pattern: - if pattern:
- if full: - if full:
- _pat = r'(\d\:{0}\-\S+)'.format(pattern) - _pat = r'(\d\:{0}\-\S+)'.format(pattern)
@ -1499,11 +1499,11 @@ index 25b26f0..91258a3 100644
+ return ret + return ret
+ +
+get_locked_packages = list_holds +get_locked_packages = list_holds
def verify(*names, **kwargs): def verify(*names, **kwargs):
@@ -1582,42 +1749,62 @@ def group_list(): @@ -1582,42 +1749,62 @@ def group_list():
salt '*' pkg.group_list salt '*' pkg.group_list
''' '''
- ret = {'installed': [], 'available': [], 'available languages': {}} - ret = {'installed': [], 'available': [], 'available languages': {}}
@ -1549,11 +1549,11 @@ index 25b26f0..91258a3 100644
+ if section_lookup is not None and section_lookup != key: + if section_lookup is not None and section_lookup != key:
+ key = section_lookup + key = section_lookup
continue continue
+ # Ignore any administrative comments (plugin info, repo info, etc.) + # Ignore any administrative comments (plugin info, repo info, etc.)
if key is None: if key is None:
continue continue
+ line = line.strip() + line = line.strip()
if key != 'available languages': if key != 'available languages':
- ret[key].append(out[idx].strip()) - ret[key].append(out[idx].strip())
@ -1570,8 +1570,8 @@ index 25b26f0..91258a3 100644
+ name, lang = match.groups() + name, lang = match.groups()
ret[key][line] = {'name': name, 'language': lang} ret[key][line] = {'name': name, 'language': lang}
return ret return ret
-def group_info(name): -def group_info(name):
+def group_info(name, expand=False): +def group_info(name, expand=False):
''' '''
@ -1584,11 +1584,11 @@ index 25b26f0..91258a3 100644
+ to ``mandatory``, ``optional``, and ``default`` for accuracy, as + to ``mandatory``, ``optional``, and ``default`` for accuracy, as
+ environment groups include other groups, and not packages. Finally, + environment groups include other groups, and not packages. Finally,
+ this function now properly identifies conditional packages. + this function now properly identifies conditional packages.
Lists packages belonging to a certain group Lists packages belonging to a certain group
@@ -1627,44 +1814,67 @@ def group_info(name): @@ -1627,44 +1814,67 @@ def group_info(name):
salt '*' pkg.group_info 'Perl Support' salt '*' pkg.group_info 'Perl Support'
''' '''
- # Not using _repoquery_pkginfo() here because group queries are handled - # Not using _repoquery_pkginfo() here because group queries are handled
@ -1611,7 +1611,7 @@ index 25b26f0..91258a3 100644
+ ret = {} + ret = {}
+ for pkgtype in pkgtypes: + for pkgtype in pkgtypes:
+ ret[pkgtype] = set() + ret[pkgtype] = set()
- for pkgtype in ('mandatory', 'optional', 'default'): - for pkgtype in ('mandatory', 'optional', 'default'):
- cmd = cmd_template.format(pkgtype, _cmd_quote(name)) - cmd = cmd_template.format(pkgtype, _cmd_quote(name))
- packages = set( - packages = set(
@ -1627,7 +1627,7 @@ index 25b26f0..91258a3 100644
+ output_loglevel='trace', + output_loglevel='trace',
+ python_shell=False + python_shell=False
+ ) + )
- # 'contitional' is not a valid --grouppkgs value. Any pkgs that show up - # 'contitional' is not a valid --grouppkgs value. Any pkgs that show up
- # in '--grouppkgs=all' that aren't in mandatory, optional, or default are - # in '--grouppkgs=all' that aren't in mandatory, optional, or default are
- # considered to be conditional packages. - # considered to be conditional packages.
@ -1639,7 +1639,7 @@ index 25b26f0..91258a3 100644
+ g_info[key.lower()] = value + g_info[key.lower()] = value
+ except ValueError: + except ValueError:
+ continue + continue
- cmd = 'repoquery --plugins --group --info {0}'.format(_cmd_quote(name)) - cmd = 'repoquery --plugins --group --info {0}'.format(_cmd_quote(name))
- out = __salt__['cmd.run_stdout']( - out = __salt__['cmd.run_stdout'](
- cmd, output_loglevel='trace' - cmd, output_loglevel='trace'
@ -1686,9 +1686,9 @@ index 25b26f0..91258a3 100644
+ +
+ for pkgtype in pkgtypes: + for pkgtype in pkgtypes:
+ ret[pkgtype] = sorted(ret[pkgtype]) + ret[pkgtype] = sorted(ret[pkgtype])
return ret return ret
@@ -1672,6 +1882,10 @@ def group_info(name): @@ -1672,6 +1882,10 @@ def group_info(name):
def group_diff(name): def group_diff(name):
''' '''
@ -1697,11 +1697,11 @@ index 25b26f0..91258a3 100644
+ Environment groups are now supported. The key names have been renamed, + Environment groups are now supported. The key names have been renamed,
+ similar to the changes made in :py:func:`pkg.group_info + similar to the changes made in :py:func:`pkg.group_info
+ <salt.modules.yumpkg.group_info>`. + <salt.modules.yumpkg.group_info>`.
Lists packages belonging to a certain group, and which are installed Lists packages belonging to a certain group, and which are installed
@@ -1681,24 +1895,117 @@ def group_diff(name): @@ -1681,24 +1895,117 @@ def group_diff(name):
salt '*' pkg.group_diff 'Perl Support' salt '*' pkg.group_diff 'Perl Support'
''' '''
- ret = { - ret = {
@ -1730,8 +1730,8 @@ index 25b26f0..91258a3 100644
- ret[key]['not installed'].append(member) - ret[key]['not installed'].append(member)
+ ret[pkgtype]['not installed'].append(member) + ret[pkgtype]['not installed'].append(member)
return ret return ret
+def group_install(name, +def group_install(name,
+ skip=(), + skip=(),
+ include=(), + include=(),
@ -1831,7 +1831,7 @@ index 25b26f0..91258a3 100644
''' '''
Lists all repos in <basedir> (default: all dirs in `reposdir` yum option). Lists all repos in <basedir> (default: all dirs in `reposdir` yum option).
@@ -1714,7 +2021,7 @@ def list_repos(basedir=None): @@ -1714,7 +2021,7 @@ def list_repos(basedir=None):
basedirs = _normalize_basedir(basedir) basedirs = _normalize_basedir(basedir)
repos = {} repos = {}
- log.debug('Searching for repos in {0}'.format(basedirs)) - log.debug('Searching for repos in {0}'.format(basedirs))
@ -1840,26 +1840,26 @@ index 25b26f0..91258a3 100644
if not os.path.exists(bdir): if not os.path.exists(bdir):
continue continue
@@ -1732,7 +2039,8 @@ def list_repos(basedir=None): @@ -1732,7 +2039,8 @@ def list_repos(basedir=None):
def get_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613 def get_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613
''' '''
- Display a repo from <basedir> (default basedir: all dirs in `reposdir` yum option). - Display a repo from <basedir> (default basedir: all dirs in `reposdir` yum option).
+ Display a repo from <basedir> (default basedir: all dirs in ``reposdir`` + Display a repo from <basedir> (default basedir: all dirs in ``reposdir``
+ yum option). + yum option).
CLI Examples: CLI Examples:
@@ -1746,7 +2054,7 @@ def get_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613 @@ -1746,7 +2054,7 @@ def get_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613
# Find out what file the repo lives in # Find out what file the repo lives in
repofile = '' repofile = ''
- for arepo in repos.keys(): - for arepo in repos.keys():
+ for arepo in six.iterkeys(repos): + for arepo in six.iterkeys(repos):
if arepo == repo: if arepo == repo:
repofile = repos[arepo]['file'] repofile = repos[arepo]['file']
@@ -1788,7 +2096,7 @@ def del_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613 @@ -1788,7 +2096,7 @@ def del_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613
# See if the repo is the only one in the file # See if the repo is the only one in the file
onlyrepo = True onlyrepo = True
- for arepo in repos.keys(): - for arepo in repos.keys():
@ -1892,13 +1892,13 @@ index 25b26f0..91258a3 100644
raise SaltInvocationError( raise SaltInvocationError(
'Cannot delete mirrorlist without specifying baseurl' 'Cannot delete mirrorlist without specifying baseurl'
) )
# Delete anything in the todelete list # Delete anything in the todelete list
for key in todelete: for key in todelete:
- if key in filerepos[repo].keys(): - if key in filerepos[repo].keys():
+ if key in six.iterkeys(filerepos[repo].copy()): + if key in six.iterkeys(filerepos[repo].copy()):
del filerepos[repo][key] del filerepos[repo][key]
# Old file or new, write out the repos(s) # Old file or new, write out the repos(s)
filerepos[repo].update(repo_opts) filerepos[repo].update(repo_opts)
content = header content = header
@ -1914,7 +1914,7 @@ index 25b26f0..91258a3 100644
+ for line in six.iterkeys(filerepos[stanza]): + for line in six.iterkeys(filerepos[stanza]):
content += '\n{0}={1}'.format(line, filerepos[stanza][line]) content += '\n{0}={1}'.format(line, filerepos[stanza][line])
content += '\n{0}\n'.format(comments) content += '\n{0}\n'.format(comments)
@@ -1997,8 +2305,8 @@ def _parse_repo_file(filename): @@ -1997,8 +2305,8 @@ def _parse_repo_file(filename):
repos[repo][comps[0].strip()] = '='.join(comps[1:]) repos[repo][comps[0].strip()] = '='.join(comps[1:])
except KeyError: except KeyError:
@ -1924,7 +1924,7 @@ index 25b26f0..91258a3 100644
+ 'Failed to parse line in %s, offending line was ' + 'Failed to parse line in %s, offending line was '
+ '\'%s\'', filename, line.rstrip() + '\'%s\'', filename, line.rstrip()
) )
return (header, repos) return (header, repos)
@@ -2077,18 +2385,15 @@ def owner(*paths): @@ -2077,18 +2385,15 @@ def owner(*paths):
return '' return ''
@ -1948,23 +1948,23 @@ index 25b26f0..91258a3 100644
- return next(ret.itervalues()) - return next(ret.itervalues())
+ return next(six.itervalues(ret)) + return next(six.itervalues(ret))
return ret return ret
@@ -2123,10 +2428,12 @@ def modified(*packages, **flags): @@ -2123,10 +2428,12 @@ def modified(*packages, **flags):
Include only files where group has been changed. Include only files where group has been changed.
time time
- Include only files where modification time of the file has been changed. - Include only files where modification time of the file has been changed.
+ Include only files where modification time of the file has been + Include only files where modification time of the file has been
+ changed. + changed.
capabilities capabilities
- Include only files where capabilities differ or not. Note: supported only on newer RPM versions. - Include only files where capabilities differ or not. Note: supported only on newer RPM versions.
+ Include only files where capabilities differ or not. Note: supported + Include only files where capabilities differ or not. Note: supported
+ only on newer RPM versions. + only on newer RPM versions.
CLI Examples: CLI Examples:
@@ -2174,11 +2481,11 @@ def download(*packages): @@ -2174,11 +2481,11 @@ def download(*packages):
for x in cached_pkgs for x in cached_pkgs
if x.startswith('{0}-'.format(pkg))]) if x.startswith('{0}-'.format(pkg))])
@ -1976,7 +1976,7 @@ index 25b26f0..91258a3 100644
except OSError as exc: except OSError as exc:
- log.error('Unable to remove {0}: {1}'.format(purge_target, exc)) - log.error('Unable to remove {0}: {1}'.format(purge_target, exc))
+ log.error('Unable to remove %s: %s', purge_target, exc) + log.error('Unable to remove %s: %s', purge_target, exc)
__salt__['cmd.run']( __salt__['cmd.run'](
'yumdownloader -q {0} --destdir={1}'.format( 'yumdownloader -q {0} --destdir={1}'.format(
@@ -2244,6 +2551,7 @@ def diff(*paths): @@ -2244,6 +2551,7 @@ def diff(*paths):
@ -1986,7 +1986,7 @@ index 25b26f0..91258a3 100644
- ret[path] = __salt__['lowpkg.diff'](local_pkgs[pkg]['path'], path) or 'Unchanged' - ret[path] = __salt__['lowpkg.diff'](local_pkgs[pkg]['path'], path) or 'Unchanged'
+ ret[path] = __salt__['lowpkg.diff']( + ret[path] = __salt__['lowpkg.diff'](
+ local_pkgs[pkg]['path'], path) or 'Unchanged' + local_pkgs[pkg]['path'], path) or 'Unchanged'
return ret return ret
diff --git a/salt/states/pkg.py b/salt/states/pkg.py diff --git a/salt/states/pkg.py b/salt/states/pkg.py
index 15c669d..3811404 100644 index 15c669d..3811404 100644
@ -2043,7 +2043,7 @@ index 15c669d..3811404 100644
+ 'changes': {}, + 'changes': {},
+ 'result': False, + 'result': False,
+ 'comment': '. '.join(comments).rstrip()} + 'comment': '. '.join(comments).rstrip()}
# Check current versions against desired versions # Check current versions against desired versions
targets = {} targets = {}
diff --git a/salt/utils/itertools.py b/salt/utils/itertools.py diff --git a/salt/utils/itertools.py b/salt/utils/itertools.py
@ -2204,3 +2204,71 @@ index 0000000..9c01d5b
+ version = ':'.join((epoch, version)) + version = ':'.join((epoch, version))
+ +
+ return pkginfo(name, version, arch, repoid) + return pkginfo(name, version, arch, repoid)
diff --git a/salt/modules/debian_ip.py b/salt/modules/debian_ip.py
index d0d6db1..275cb97 100644
--- a/salt/modules/debian_ip.py
+++ b/salt/modules/debian_ip.py
@@ -819,9 +819,12 @@ def _parse_settings_bond_0(opts, iface, bond_def):
if 'arp_ip_target' in opts:
if isinstance(opts['arp_ip_target'], list):
if 1 <= len(opts['arp_ip_target']) <= 16:
- bond.update({'arp_ip_target': []})
+ bond.update({'arp_ip_target': ''})
for ip in opts['arp_ip_target']: # pylint: disable=C0103
- bond['arp_ip_target'].append(ip)
+ if len(bond['arp_ip_target']) > 0:
+ bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
+ else:
+ bond['arp_ip_target'] = ip
else:
_raise_error_iface(iface, 'arp_ip_target', valid)
else:
@@ -892,9 +895,12 @@ def _parse_settings_bond_2(opts, iface, bond_def):
if 'arp_ip_target' in opts:
if isinstance(opts['arp_ip_target'], list):
if 1 <= len(opts['arp_ip_target']) <= 16:
- bond.update({'arp_ip_target': []})
+ bond.update({'arp_ip_target': ''})
for ip in opts['arp_ip_target']: # pylint: disable=C0103
- bond['arp_ip_target'].append(ip)
+ if len(bond['arp_ip_target']) > 0:
+ bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
+ else:
+ bond['arp_ip_target'] = ip
else:
_raise_error_iface(iface, 'arp_ip_target', valid)
else:
diff --git a/salt/modules/rh_ip.py b/salt/modules/rh_ip.py
index 2762125..cd362e4 100644
--- a/salt/modules/rh_ip.py
+++ b/salt/modules/rh_ip.py
@@ -276,9 +276,12 @@ def _parse_settings_bond_0(opts, iface, bond_def):
if 'arp_ip_target' in opts:
if isinstance(opts['arp_ip_target'], list):
if 1 <= len(opts['arp_ip_target']) <= 16:
- bond.update({'arp_ip_target': []})
+ bond.update({'arp_ip_target': ''})
for ip in opts['arp_ip_target']: # pylint: disable=C0103
- bond['arp_ip_target'].append(ip)
+ if len(bond['arp_ip_target']) > 0:
+ bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
+ else:
+ bond['arp_ip_target'] = ip
else:
_raise_error_iface(iface, 'arp_ip_target', valid)
else:
@@ -349,9 +352,12 @@ def _parse_settings_bond_2(opts, iface, bond_def):
if 'arp_ip_target' in opts:
if isinstance(opts['arp_ip_target'], list):
if 1 <= len(opts['arp_ip_target']) <= 16:
- bond.update({'arp_ip_target': []})
+ bond.update({'arp_ip_target': ''})
for ip in opts['arp_ip_target']: # pylint: disable=C0103
- bond['arp_ip_target'].append(ip)
+ if len(bond['arp_ip_target']) > 0:
+ bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
+ else:
+ bond['arp_ip_target'] = ip
else:
_raise_error_iface(iface, 'arp_ip_target', valid)
else:

@ -16,7 +16,7 @@
Name: salt Name: salt
Version: 2015.5.10 Version: 2015.5.10
Release: 1%{?dist} Release: 2%{?dist}
Summary: A parallel remote execution system Summary: A parallel remote execution system
Group: System Environment/Daemons Group: System Environment/Daemons
@ -460,6 +460,9 @@ rm -rf %{buildroot}
%endif %endif
%changelog %changelog
* Tue May 31 2016 Erik Johnson <erik@saltstack.com> - 2015.5.10-2
- Updated patch
* Fri May 27 2016 Erik Johnson <erik@saltstack.com> - 2015.5.10-1 * Fri May 27 2016 Erik Johnson <erik@saltstack.com> - 2015.5.10-1
- Update to bugfix release 2015.5.10 - Update to bugfix release 2015.5.10

Loading…
Cancel
Save