Hello community,

here is the log from the commit of package salt for openSUSE:Factory checked in 
at 2018-02-09 15:48:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/salt (Old)
 and      /work/SRC/openSUSE:Factory/.salt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "salt"

Fri Feb  9 15:48:16 2018 rev:71 rq:574155 version:2017.7.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/salt/salt.changes        2018-01-28 
20:33:23.790964908 +0100
+++ /work/SRC/openSUSE:Factory/.salt.new/salt.changes   2018-02-09 
15:48:21.625636471 +0100
@@ -1,0 +2,17 @@
+Wed Feb 07 13:23:51 UTC 2018 - Mihai Dinca <mdi...@suse.de>
+
+- Prevent queryformat pattern from expanding (bsc#1079048)
+
+-------------------------------------------------------------------
+Thu Feb 01 12:38:12 UTC 2018 - jbre...@suse.de
+
+- Fix epoch handling for Rhel 6 and 7 (bsc#1068566)
+- Reverting to current API for split_input
+
+- Added:
+  * yumpkg-don-t-use-diff_attr-when-determining-install-.patch
+
+- Removed:
+  * fix-for-wrong-version-processing.patch
+
+-------------------------------------------------------------------
@@ -4 +21 @@
-- Fix for wrong version processing during yum pkg install
+- Fix for wrong version processing during yum pkg install (bsc#1068566)
@@ -115 +132 @@
-- Older logrotate need su directive
+- Older logrotate need su directive (bsc#1071322)

Old:
----
  fix-for-wrong-version-processing.patch

New:
----
  yumpkg-don-t-use-diff_attr-when-determining-install-.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ salt.spec ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:22.869591799 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:22.873591656 +0100
@@ -77,17 +77,17 @@
 Patch10:       fix-for-delete_deployment-in-kubernetes-module.patch
 Patch11:       catching-error-when-pidfile-cannot-be-deleted.patch
 Patch12:       avoid-excessive-syslogging-by-watchdog-cronjob-58.patch
-Patch13:       fix-for-wrong-version-processing.patch
-Patch14:       older-logrotate-need-su-directive.patch
-Patch15:       fix-salt-master-for-old-psutil.patch
-Patch16:       split-only-strings-if-they-are-such.patch
-Patch17:       cherrypy-read-reads-bytes-from-the-wire-and-write-th.patch
-Patch19:       python3-compatibility-fix-got-bytes-instead-of-strin.patch
-Patch20:       feat-add-grain-for-all-fqdns.patch
-Patch21:       fix-bsc-1065792.patch
-Patch22:       set-shell-environment-variable-64.patch
-Patch23:       bugfix-the-logic-according-to-the-exact-described-pu.patch
-Patch24:       return-error-when-gid_from_name-and-group-does-not-e.patch
+Patch13:       older-logrotate-need-su-directive.patch
+Patch14:       fix-salt-master-for-old-psutil.patch
+Patch15:       split-only-strings-if-they-are-such.patch
+Patch16:       cherrypy-read-reads-bytes-from-the-wire-and-write-th.patch
+Patch17:       python3-compatibility-fix-got-bytes-instead-of-strin.patch
+Patch19:       feat-add-grain-for-all-fqdns.patch
+Patch20:       fix-bsc-1065792.patch
+Patch21:       set-shell-environment-variable-64.patch
+Patch22:       bugfix-the-logic-according-to-the-exact-described-pu.patch
+Patch23:       return-error-when-gid_from_name-and-group-does-not-e.patch
+Patch24:       yumpkg-don-t-use-diff_attr-when-determining-install-.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  logrotate
@@ -904,7 +904,7 @@
   true
 fi
 %if %{with systemd}
-if [ `rpm -q systemd --queryformat="%{VERSION}"` -lt 228 ]; then
+if [ `rpm -q systemd --queryformat="%%{VERSION}"` -lt 228 ]; then
   # On systemd < 228 the 'TasksTask' attribute is not available.
   # Removing TasksMax from salt-master.service on SLE12SP1 LTSS (bsc#985112)
   sed -i '/TasksMax=infinity/d' %{_unitdir}/salt-master.service

++++++ activate-all-beacons-sources-config-pillar-grains.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:22.941589214 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:22.941589214 +0100
@@ -21,6 +21,6 @@
                  return self.beacons.process(b_conf, self.opts['grains'])  # 
pylint: disable=no-member
          return []
 -- 
-2.15.1
+2.13.6
 
 

++++++ avoid-excessive-syslogging-by-watchdog-cronjob-58.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:22.957588639 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:22.957588639 +0100
@@ -1,4 +1,4 @@
-From a94f7d5739fd38529ebf23a89e6afc164739dd8d Mon Sep 17 00:00:00 2001
+From 35984b8055beccc94b3bd92b637c5435db822cc9 Mon Sep 17 00:00:00 2001
 From: Hubert Mantel <man...@suse.de>
 Date: Mon, 27 Nov 2017 13:55:13 +0100
 Subject: [PATCH] avoid excessive syslogging by watchdog cronjob (#58)
@@ -21,6 +21,6 @@
          /usr/bin/salt-daemon-watcher --with-init & disown
      fi
 -- 
-2.15.1
+2.13.6
 
 

++++++ bugfix-always-return-a-string-list-on-unknown-job-ta.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:22.969588208 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:22.977587921 +0100
@@ -64,6 +64,6 @@
  
      if 'metadata' in job:
 -- 
-2.15.1
+2.13.6
 
 

++++++ bugfix-the-logic-according-to-the-exact-described-pu.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:22.993587346 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:22.997587203 +0100
@@ -1,4 +1,4 @@
-From 0e1cac43dd8211186d6794602f6da77f612850a7 Mon Sep 17 00:00:00 2001
+From 2388f136acc805f1ec605206d38db650a877be1c Mon Sep 17 00:00:00 2001
 From: Bo Maryniuk <b...@suse.de>
 Date: Tue, 21 Nov 2017 12:53:11 +0100
 Subject: [PATCH] Bugfix the logic according to the exact described
@@ -311,6 +311,6 @@
 +                                  ({}, errors)]:
 +                    assert res == state._get_pillar_errors(kwargs=opts, 
pillar=ext_pillar)
 -- 
-2.15.1
+2.13.6
 
 

++++++ cherrypy-read-reads-bytes-from-the-wire-and-write-th.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.025586197 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.025586197 +0100
@@ -1,4 +1,4 @@
-From b31d8f3898149209097e01bbeefbfb70b5a0c395 Mon Sep 17 00:00:00 2001
+From c586654ed4c20a69f164b208458163611408c54a Mon Sep 17 00:00:00 2001
 From: Michael Calmer <m...@suse.de>
 Date: Fri, 15 Dec 2017 09:53:10 +0100
 Subject: [PATCH] cherrypy read() reads bytes from the wire and write
@@ -112,6 +112,6 @@
          if headers is not None:
              h.update(headers)
 -- 
-2.15.1
+2.13.6
 
 

++++++ enable-with-salt-version-parameter-for-setup.py-scri.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.037585766 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.037585766 +0100
@@ -71,6 +71,6 @@
          self.salt_version = __version__  # pylint: disable=undefined-variable
          self.description = 'Portable, distributed, remote execution and 
configuration management system'
 -- 
-2.15.1
+2.13.6
 
 

++++++ feat-add-grain-for-all-fqdns.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.053585191 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.053585191 +0100
@@ -1,4 +1,4 @@
-From ba9f26cf00b0a767b7b25f156553a9e783aa895d Mon Sep 17 00:00:00 2001
+From a1aec4e0d740c179657765ab30475d11f9950174 Mon Sep 17 00:00:00 2001
 From: Michele Bologna <michele.bolo...@suse.com>
 Date: Thu, 14 Dec 2017 18:20:02 +0100
 Subject: [PATCH] Feat: add grain for all FQDNs

++++++ fix-bsc-1065792.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.069584617 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.069584617 +0100
@@ -1,4 +1,4 @@
-From e6b1c05fb9e38e54ad30a540a32cd8491fee286b Mon Sep 17 00:00:00 2001
+From 7e118cb36bacdc50606512adc562438fcc3257e2 Mon Sep 17 00:00:00 2001
 From: Bo Maryniuk <b...@suse.de>
 Date: Thu, 14 Dec 2017 16:21:40 +0100
 Subject: [PATCH] Fix bsc#1065792
@@ -20,6 +20,6 @@
          return __virtualname__
      else:
 -- 
-2.15.1
+2.13.6
 
 

++++++ fix-for-delete_deployment-in-kubernetes-module.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.085584042 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.089583899 +0100
@@ -248,6 +248,6 @@
 +                    kubernetes.kubernetes.client.ExtensionsV1beta1Api().
 +                    create_namespaced_deployment().to_dict.called)
 -- 
-2.15.1
+2.13.6
 
 

++++++ fix-salt-master-for-old-psutil.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.101583467 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.101583467 +0100
@@ -1,4 +1,4 @@
-From e9635560f2b0a213518c5023e0b6fb4a11e5570d Mon Sep 17 00:00:00 2001
+From 1828df2c90f82db3b1c8a1cb968245f38e2380fe Mon Sep 17 00:00:00 2001
 From: Mihai Dinca <mdi...@suse.de>
 Date: Fri, 8 Dec 2017 13:34:06 +0100
 Subject: [PATCH] Fix salt-master for old psutil
@@ -21,6 +21,6 @@
              _globals[attr] = getattr(_temp, attr)
          except AttributeError:
 -- 
-2.15.1
+2.13.6
 
 

++++++ introduce-process_count_max-minion-configuration-par.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.121582749 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.121582749 +0100
@@ -206,6 +206,6 @@
 +            finally:
 +                minion.destroy()
 -- 
-2.15.1
+2.13.6
 
 

++++++ list_pkgs-add-parameter-for-returned-attribute-selec.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.141582031 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.141582031 +0100
@@ -787,6 +787,6 @@
      def test_list_patches(self):
          '''
 -- 
-2.15.1
+2.13.6
 
 

++++++ multiprocessing-minion-option-documentation-fixes.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.161581313 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.161581313 +0100
@@ -42,6 +42,6 @@
  
  
 -- 
-2.15.1
+2.13.6
 
 

++++++ older-logrotate-need-su-directive.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.177580739 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.177580739 +0100
@@ -1,4 +1,4 @@
-From d68365a35dd00cced7cdc6eff2ad8a3b823c26f6 Mon Sep 17 00:00:00 2001
+From c0a3f1a73c5ca49c94ba9eae94193baf2d08c7eb Mon Sep 17 00:00:00 2001
 From: Michael Calmer <m...@suse.de>
 Date: Thu, 7 Dec 2017 17:30:31 +0100
 Subject: [PATCH] older logrotate need su directive
@@ -20,6 +20,6 @@
        missingok
        rotate 7
 -- 
-2.15.1
+2.13.6
 
 

++++++ python3-compatibility-fix-got-bytes-instead-of-strin.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.197580021 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.201579876 +0100
@@ -1,4 +1,4 @@
-From d21ea1062f1cd8da0e604288b369c7ff38919c78 Mon Sep 17 00:00:00 2001
+From 01467c793bddad471ba425918064dffb0ee21bdf Mon Sep 17 00:00:00 2001
 From: Michael Calmer <m...@suse.de>
 Date: Tue, 19 Dec 2017 17:07:19 +0100
 Subject: [PATCH] python3 compatibility fix - got bytes instead of string

++++++ return-error-when-gid_from_name-and-group-does-not-e.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.233578728 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.233578728 +0100
@@ -1,4 +1,4 @@
-From 5384cb815764af43f287bcb6ed49a9a68d5cd5c0 Mon Sep 17 00:00:00 2001
+From 85ddadf0815071c0000fddca3f0b4a62da69bceb Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
  <psuarezhernan...@suse.com>
 Date: Wed, 10 Jan 2018 11:59:33 +0000
@@ -118,6 +118,6 @@
      def test_user_present_gid_from_name(self):
          '''
 -- 
-2.15.1
+2.13.6
 
 

++++++ run-salt-api-as-user-salt-bsc-1064520.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.249578154 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.249578154 +0100
@@ -20,6 +20,6 @@
  ExecStart=/usr/bin/salt-api
  TimeoutStopSec=3
 -- 
-2.15.1
+2.13.6
 
 

++++++ run-salt-master-as-dedicated-salt-user.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.281577004 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.281577004 +0100
@@ -42,6 +42,6 @@
        missingok
        rotate 7
 -- 
-2.15.1
+2.13.6
 
 

++++++ set-shell-environment-variable-64.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.313575855 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.313575855 +0100
@@ -1,4 +1,4 @@
-From 7f207ed0aa45063e90db2452a311b91f34b1b7e2 Mon Sep 17 00:00:00 2001
+From 38f5221734b84d8d3188db82ff4873cd89a4a85c Mon Sep 17 00:00:00 2001
 From: Johannes Renner <jren...@suse.com>
 Date: Thu, 11 Jan 2018 15:55:25 +0100
 Subject: [PATCH] Set SHELL environment variable (#64)

++++++ split-only-strings-if-they-are-such.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.329575280 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.329575280 +0100
@@ -1,4 +1,4 @@
-From 358d18a0cc635b04503d5392ce337227c1f191af Mon Sep 17 00:00:00 2001
+From 3fa025fc994d307e08ef271ca8463fe837891a63 Mon Sep 17 00:00:00 2001
 From: Bo Maryniuk <b...@suse.de>
 Date: Thu, 14 Dec 2017 14:43:52 +0100
 Subject: [PATCH] Split only strings, if they are such
@@ -45,6 +45,6 @@
                  self.as_list = details['as_list']
                  if details['with_lists']:
 -- 
-2.15.1
+2.13.6
 
 

++++++ use-home-to-get-the-user-home-directory-instead-usin.patch ++++++
--- /var/tmp/diff_new_pack.f3ZNoq/_old  2018-02-09 15:48:23.373573700 +0100
+++ /var/tmp/diff_new_pack.f3ZNoq/_new  2018-02-09 15:48:23.377573556 +0100
@@ -24,6 +24,6 @@
  
      if [ ! -d "$(dirname ${_salt_cache_functions})" ]; then
 -- 
-2.15.1
+2.13.6
 
 

++++++ yumpkg-don-t-use-diff_attr-when-determining-install-.patch ++++++
>From ea9c1f9a83b42b773579d5ef34dc29249bcd680a Mon Sep 17 00:00:00 2001
From: Erik Johnson <paleh...@gmail.com>
Date: Thu, 4 Jan 2018 16:10:18 -0600
Subject: [PATCH] yumpkg: don't use diff_attr when determining
 install/downgrade targets

Doing so breaks epoch handling, and is unnecessary anyway since the
diff_attr is only used for the return data.

Additionally, this tweaks the "attr" argument in both yumpkg and
zypper's list_pkgs func so that it will accept a comma-separated list as
well as a Python list, and makes a DRY tweak so that we're only
returning and formatting the return data in one place in the function.
---
 salt/modules/yumpkg.py | 83 ++++++++++++++++++++++++++++----------------------
 salt/modules/zypper.py | 45 +++++++++++++++------------
 2 files changed, 73 insertions(+), 55 deletions(-)

diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py
index 8b63bff4a3..89aceb21cb 100644
--- a/salt/modules/yumpkg.py
+++ b/salt/modules/yumpkg.py
@@ -622,6 +622,7 @@ def list_pkgs(versions_as_list=False, **kwargs):
     .. code-block:: bash
 
         salt '*' pkg.list_pkgs
+        salt '*' pkg.list_pkgs attr=version,arch
         salt '*' pkg.list_pkgs attr='["version", "arch"]'
     '''
     versions_as_list = salt.utils.is_true(versions_as_list)
@@ -630,42 +631,52 @@ def list_pkgs(versions_as_list=False, **kwargs):
             for x in ('removed', 'purge_desired')]):
         return {}
 
-    attr = kwargs.get("attr")
-    if 'pkg.list_pkgs' in __context__:
-        cached = __context__['pkg.list_pkgs']
-        return __salt__['pkg_resource.format_pkg_list'](cached, 
versions_as_list, attr)
+    attr = kwargs.get('attr')
+    if attr is not None:
+        attr = salt.utils.split_input(attr)
 
-    ret = {}
-    cmd = ['rpm', '-qa', '--queryformat',
-           salt.utils.pkg.rpm.QUERYFORMAT.replace('%{REPOID}', '(none)') + 
'\n']
-    output = __salt__['cmd.run'](cmd,
-                                 python_shell=False,
-                                 output_loglevel='trace')
-    for line in output.splitlines():
-        pkginfo = salt.utils.pkg.rpm.parse_pkginfo(
-            line,
-            osarch=__grains__['osarch']
-        )
-        if pkginfo is not None:
-            # see rpm version string rules available at https://goo.gl/UGKPNd
-            pkgver = pkginfo.version
-            epoch = ''
-            release = ''
-            if ':' in pkgver:
-                epoch, pkgver = pkgver.split(":", 1)
-            if '-' in pkgver:
-                pkgver, release = pkgver.split("-", 1)
-            all_attr = {'epoch': epoch, 'version': pkgver, 'release': release,
-                        'arch': pkginfo.arch, 'install_date': 
pkginfo.install_date,
-                        'install_date_time_t': pkginfo.install_date_time_t}
-            __salt__['pkg_resource.add_pkg'](ret, pkginfo.name, all_attr)
-
-    for pkgname in ret:
-        ret[pkgname] = sorted(ret[pkgname], key=lambda d: d['version'])
-
-    __context__['pkg.list_pkgs'] = ret
+    contextkey = 'pkg.list_pkgs'
 
-    return __salt__['pkg_resource.format_pkg_list'](ret, versions_as_list, 
attr)
+    if contextkey not in __context__:
+        ret = {}
+        cmd = ['rpm', '-qa', '--queryformat',
+               salt.utils.pkg.rpm.QUERYFORMAT.replace('%{REPOID}', '(none)') + 
'\n']
+        output = __salt__['cmd.run'](cmd,
+                                     python_shell=False,
+                                     output_loglevel='trace')
+        for line in output.splitlines():
+            pkginfo = salt.utils.pkg.rpm.parse_pkginfo(
+                line,
+                osarch=__grains__['osarch']
+            )
+            if pkginfo is not None:
+                # see rpm version string rules available at 
https://goo.gl/UGKPNd
+                pkgver = pkginfo.version
+                epoch = ''
+                release = ''
+                if ':' in pkgver:
+                    epoch, pkgver = pkgver.split(":", 1)
+                if '-' in pkgver:
+                    pkgver, release = pkgver.split("-", 1)
+                all_attr = {
+                    'epoch': epoch,
+                    'version': pkgver,
+                    'release': release,
+                    'arch': pkginfo.arch,
+                    'install_date': pkginfo.install_date,
+                    'install_date_time_t': pkginfo.install_date_time_t
+                }
+                __salt__['pkg_resource.add_pkg'](ret, pkginfo.name, all_attr)
+
+        for pkgname in ret:
+            ret[pkgname] = sorted(ret[pkgname], key=lambda d: d['version'])
+
+        __context__[contextkey] = ret
+
+    return __salt__['pkg_resource.format_pkg_list'](
+        __context__[contextkey],
+        versions_as_list,
+        attr)
 
 
 def list_repo_pkgs(*args, **kwargs):
@@ -1311,11 +1322,11 @@ def install(name=None,
             log.warning('"version" parameter will be ignored for multiple '
                         'package targets')
 
-    diff_attr = kwargs.get("diff_attr")
+    diff_attr = kwargs.get('diff_attr')
     old = list_pkgs(versions_as_list=False, attr=diff_attr) if not 
downloadonly else list_downloaded()
     # Use of __context__ means no duplicate work here, just accessing
     # information already in __context__ from the previous call to list_pkgs()
-    old_as_list = list_pkgs(versions_as_list=True, attr=diff_attr) if not 
downloadonly else list_downloaded()
+    old_as_list = list_pkgs(versions_as_list=True) if not downloadonly else 
list_downloaded()
 
     to_install = []
     to_downgrade = []
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index b440af08a4..ffe38be17d 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -685,6 +685,7 @@ def list_pkgs(versions_as_list=False, **kwargs):
     .. code-block:: bash
 
         salt '*' pkg.list_pkgs
+        salt '*' pkg.list_pkgs attr=version,arch
         salt '*' pkg.list_pkgs attr='["version", "arch"]'
     '''
     versions_as_list = salt.utils.is_true(versions_as_list)
@@ -693,30 +694,36 @@ def list_pkgs(versions_as_list=False, **kwargs):
             for x in ('removed', 'purge_desired')]):
         return {}
 
-    attr = kwargs.get("attr")
-    if 'pkg.list_pkgs' in __context__:
-        cached = __context__['pkg.list_pkgs']
-        return __salt__['pkg_resource.format_pkg_list'](cached, 
versions_as_list, attr)
+    attr = kwargs.get('attr')
+    if attr is not None:
+        attr = salt.utils.split_input(attr)
 
-    cmd = ['rpm', '-qa', '--queryformat', (
-        "%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-"
-        "%|EPOCH?{%{EPOCH}}:{}|_|-%{INSTALLTIME}\\n")]
-    ret = {}
-    for line in __salt__['cmd.run'](cmd, output_loglevel='trace', 
python_shell=False).splitlines():
-        name, pkgver, rel, arch, epoch, install_time = line.split('_|-')
-        install_date = 
datetime.datetime.utcfromtimestamp(int(install_time)).isoformat() + "Z"
-        install_date_time_t = int(install_time)
+    contextkey = 'pkg.list_pkgs'
+
+    if contextkey not in __context__:
+
+        cmd = ['rpm', '-qa', '--queryformat', (
+            "%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-"
+            "%|EPOCH?{%{EPOCH}}:{}|_|-%{INSTALLTIME}\\n")]
+        ret = {}
+        for line in __salt__['cmd.run'](cmd, output_loglevel='trace', 
python_shell=False).splitlines():
+            name, pkgver, rel, arch, epoch, install_time = line.split('_|-')
+            install_date = 
datetime.datetime.utcfromtimestamp(int(install_time)).isoformat() + "Z"
+            install_date_time_t = int(install_time)
 
-        all_attr = {'epoch': epoch, 'version': pkgver, 'release': rel, 'arch': 
arch,
-                    'install_date': install_date, 'install_date_time_t': 
install_date_time_t}
-        __salt__['pkg_resource.add_pkg'](ret, name, all_attr)
+            all_attr = {'epoch': epoch, 'version': pkgver, 'release': rel, 
'arch': arch,
+                        'install_date': install_date, 'install_date_time_t': 
install_date_time_t}
+            __salt__['pkg_resource.add_pkg'](ret, name, all_attr)
 
-    for pkgname in ret:
-        ret[pkgname] = sorted(ret[pkgname], key=lambda d: d['version'])
+        for pkgname in ret:
+            ret[pkgname] = sorted(ret[pkgname], key=lambda d: d['version'])
 
-    __context__['pkg.list_pkgs'] = ret
+        __context__[contextkey] = ret
 
-    return __salt__['pkg_resource.format_pkg_list'](ret, versions_as_list, 
attr)
+    return __salt__['pkg_resource.format_pkg_list'](
+        __context__[contextkey],
+        versions_as_list,
+        attr)
 
 
 def _get_configured_repos():
-- 
2.13.6



Reply via email to