Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yumpkg: Avoid spurious logging in pkg.upgrade #34524

Merged
merged 1 commit into from
Jul 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions salt/modules/yumpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,10 +1228,10 @@ def _add_common_args(cmd):
return ret


def upgrade(refresh=True,
skip_verify=False,
name=None,
def upgrade(name=None,
pkgs=None,
refresh=True,
skip_verify=False,
normalize=True,
**kwargs):
'''
Expand Down Expand Up @@ -1314,7 +1314,7 @@ def upgrade(refresh=True,

.. 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.upgrade gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False

.. versionadded:: 2016.3.0

Expand All @@ -1327,20 +1327,23 @@ def upgrade(refresh=True,
refresh_db(**kwargs)

old = list_pkgs()
try:
pkg_params = __salt__['pkg_resource.parse_targets'](
name=name,
pkgs=pkgs,
sources=None,
normalize=normalize,
**kwargs)[0]
except MinionError as exc:
raise CommandExecutionError(exc)

if pkg_params:
targets = [x for x in pkg_params]
else:
targets = None
targets = []
if name or pkgs:
try:
pkg_params = __salt__['pkg_resource.parse_targets'](
name=name,
pkgs=pkgs,
sources=None,
normalize=normalize,
**kwargs)[0]
except MinionError as exc:
raise CommandExecutionError(exc)

if pkg_params:
# Calling list.extend() on a dict will extend it using the
# dictionary's keys.
targets.extend(pkg_params)

cmd = [_yum(), '--quiet', '-y']
for args in (repo_arg, exclude_arg, branch_arg):
Expand All @@ -1349,8 +1352,7 @@ def upgrade(refresh=True,
if skip_verify:
cmd.append('--nogpgcheck')
cmd.append('upgrade')
if targets:
cmd.extend(targets)
cmd.extend(targets)

__salt__['cmd.run'](cmd, output_loglevel='trace', python_shell=False)
__context__.pop('pkg.list_pkgs', None)
Expand Down