From ec78ceeb582347b44a4973ca5305b44bb7f720cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= Date: Tue, 21 Mar 2017 11:10:06 +0000 Subject: [PATCH] Adding support for installing patches in yum/dnf execution module --- salt/modules/yumpkg.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py index 8637eba159..4c1b75d4a1 100644 --- a/salt/modules/yumpkg.py +++ b/salt/modules/yumpkg.py @@ -1171,9 +1171,14 @@ def install(name=None, reinstall = salt.utils.is_true(reinstall) try: - pkg_params, pkg_type = __salt__['pkg_resource.parse_targets']( - name, pkgs, sources, normalize=normalize, **kwargs - ) + if "advisory_ids" in kwargs: + if pkgs: + raise SaltInvocationError('Cannot use "advisory_ids" and "pkgs" at the same time') + pkg_params, pkg_type = kwargs['advisory_ids'], 'advisory' + else: + pkg_params, pkg_type = __salt__['pkg_resource.parse_targets']( + name, pkgs, sources, normalize=normalize, **kwargs + ) except MinionError as exc: raise CommandExecutionError(exc) @@ -1418,6 +1423,8 @@ def install(name=None, targets = [] with _temporarily_unhold(to_install, targets): if targets: + if pkg_type == 'advisory': + targets = ["--advisory={0}".format(t) for t in targets] cmd = [] if salt.utils.systemd.has_scope(__context__) \ and __salt__['config.get']('systemd.scope', True): @@ -1426,7 +1433,7 @@ def install(name=None, if _yum() == 'dnf': cmd.extend(['--best', '--allowerasing']) _add_common_args(cmd) - cmd.append('install') + cmd.append('install' if pkg_type is not 'advisory' else 'update') cmd.extend(targets) out = __salt__['cmd.run_all']( cmd,