2020-04-07 14:14:01 +02:00
|
|
|
From cd66b1e6636013440577a38a5a68729fec2f3f99 Mon Sep 17 00:00:00 2001
|
2018-07-30 13:52:13 +02:00
|
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
|
|
<psuarezhernandez@suse.com>
|
|
|
|
Date: Mon, 14 May 2018 11:33:13 +0100
|
|
|
|
Subject: [PATCH] Add "all_versions" parameter to include all installed
|
|
|
|
version on rpm.info
|
|
|
|
|
|
|
|
Enable "all_versions" parameter for zypper.info_installed
|
|
|
|
|
|
|
|
Enable "all_versions" parameter for yumpkg.info_installed
|
|
|
|
|
|
|
|
Prevent adding failed packages when pkg name contains the arch (on SUSE)
|
|
|
|
|
|
|
|
Add 'all_versions' documentation for info_installed on yum/zypper modules
|
|
|
|
|
|
|
|
Add unit tests for info_installed with all_versions
|
|
|
|
|
|
|
|
Refactor: use dict.setdefault instead if-else statement
|
|
|
|
|
|
|
|
Allow removing only specific package versions with zypper and yum
|
|
|
|
---
|
2019-04-12 11:57:21 +02:00
|
|
|
salt/states/pkg.py | 21 +++++++++++++++++++++
|
|
|
|
1 file changed, 21 insertions(+)
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
diff --git a/salt/states/pkg.py b/salt/states/pkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
index a13d418400..c0fa2f6b69 100644
|
2018-07-30 13:52:13 +02:00
|
|
|
--- a/salt/states/pkg.py
|
|
|
|
+++ b/salt/states/pkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
@@ -450,6 +450,16 @@ def _find_remove_targets(name=None,
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
if __grains__['os'] == 'FreeBSD' and origin:
|
|
|
|
cver = [k for k, v in six.iteritems(cur_pkgs) if v['origin'] == pkgname]
|
|
|
|
+ elif __grains__['os_family'] == 'Suse':
|
|
|
|
+ # On SUSE systems. Zypper returns packages without "arch" in name
|
|
|
|
+ try:
|
|
|
|
+ namepart, archpart = pkgname.rsplit('.', 1)
|
|
|
|
+ except ValueError:
|
|
|
|
+ cver = cur_pkgs.get(pkgname, [])
|
|
|
|
+ else:
|
|
|
|
+ if archpart in salt.utils.pkg.rpm.ARCHES + ("noarch",):
|
|
|
|
+ pkgname = namepart
|
|
|
|
+ cver = cur_pkgs.get(pkgname, [])
|
|
|
|
else:
|
|
|
|
cver = cur_pkgs.get(pkgname, [])
|
|
|
|
|
2020-04-07 14:14:01 +02:00
|
|
|
@@ -856,6 +866,17 @@ def _verify_install(desired, new_pkgs, ignore_epoch=False, new_caps=None):
|
2018-07-30 13:52:13 +02:00
|
|
|
cver = new_pkgs.get(pkgname.split('%')[0])
|
|
|
|
elif __grains__['os_family'] == 'Debian':
|
|
|
|
cver = new_pkgs.get(pkgname.split('=')[0])
|
|
|
|
+ elif __grains__['os_family'] == 'Suse':
|
|
|
|
+ # On SUSE systems. Zypper returns packages without "arch" in name
|
|
|
|
+ try:
|
|
|
|
+ namepart, archpart = pkgname.rsplit('.', 1)
|
|
|
|
+ except ValueError:
|
|
|
|
+ cver = new_pkgs.get(pkgname)
|
|
|
|
+ else:
|
|
|
|
+ if archpart in salt.utils.pkg.rpm.ARCHES + ("noarch",):
|
|
|
|
+ cver = new_pkgs.get(namepart)
|
|
|
|
+ else:
|
|
|
|
+ cver = new_pkgs.get(pkgname)
|
|
|
|
else:
|
|
|
|
cver = new_pkgs.get(pkgname)
|
|
|
|
if not cver and pkgname in new_caps:
|
|
|
|
--
|
2019-11-28 16:41:55 +01:00
|
|
|
2.16.4
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
|