File add-patch-support-for-allow-vendor-change-option-wit.patch of Package salt.18653
From 16082f73a7004de53043a2f1bee11754efcc75d7 Mon Sep 17 00:00:00 2001
From: Martin Seidl <mseidl@suse.de>
Date: Mon, 7 Dec 2020 01:10:51 +0100
Subject: [PATCH] add patch support for allow vendor change option with
zypper
---
salt/modules/zypperpkg.py | 42 +++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/salt/modules/zypperpkg.py b/salt/modules/zypperpkg.py
index 8200adfe24..a6c5aa3265 100644
--- a/salt/modules/zypperpkg.py
+++ b/salt/modules/zypperpkg.py
@@ -1368,6 +1368,7 @@ def install(name=None,
no_recommends=False,
root=None,
inclusion_detection=False,
+ novendorchange=True,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
@@ -1414,6 +1415,10 @@ def install(name=None,
skip_verify
Skip the GPG verification check (e.g., ``--no-gpg-checks``)
+
+ novendorchange
+ Disallow vendor change
+
version
Can be either a version number, or the combination of a comparison
operator (<, >, <=, >=, =) and a version number (ex. '>1.2.3-4').
@@ -1563,6 +1568,19 @@ def install(name=None,
cmd_install = ['install', '--auto-agree-with-licenses']
cmd_install.append(kwargs.get('resolve_capabilities') and '--capability' or '--name')
+ if novendorchange:
+ if __grains__["osrelease_info"][0] > 11:
+ cmd_install.append("--no-allow-vendor-change")
+ log.info("Disabling vendor changes")
+ else:
+ log.warning("Enabling/Disabling vendor changes is not supported on this Zypper version")
+ else:
+ if __grains__["osrelease_info"][0] > 11:
+ cmd_install.append("--allow-vendor-change")
+ log.info("Enabling vendor changes")
+ else:
+ log.warning("Enabling/Disabling vendor changes is not supported on this Zypper version")
+
if not refresh:
cmd_install.insert(0, '--no-refresh')
@@ -1574,7 +1592,6 @@ def install(name=None,
cmd_install.extend(fromrepoopt)
if no_recommends:
cmd_install.append('--no-recommends')
-
errors = []
# Split the targets into batches of 500 packages each, so that
@@ -1700,19 +1717,18 @@ def upgrade(refresh=True,
cmd_update.extend(['--from' if dist_upgrade else '--repo', repo])
log.info('Targeting repos: %s', fromrepo)
- if dist_upgrade:
- # TODO: Grains validation should be moved to Zypper class
- if __grains__["osrelease_info"][0] > 11:
- if novendorchange:
- cmd_update.append("--no-allow-vendor-change")
- log.info("Disabling vendor changes")
- else:
- cmd_update.append("--allow-vendor-change")
- log.info("Enabling vendor changes")
+ # TODO: Grains validation should be moved to Zypper class
+ if __grains__["osrelease_info"][0] > 11:
+ if novendorchange:
+ cmd_update.append("--no-allow-vendor-change")
+ log.info("Disabling vendor changes")
else:
- log.warning(
- "Enabling/Disabling vendor changes is not supported on this Zypper version"
- )
+ cmd_update.append("--allow-vendor-change")
+ log.info("Enabling vendor changes")
+ else:
+ log.warning(
+ "Enabling/Disabling vendor changes is not supported on this Zypper version"
+ )
if no_recommends:
cmd_update.append('--no-recommends')
--
2.29.2