Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package salt for openSUSE:Factory checked in 
at 2021-11-18 10:33:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/salt (Old)
 and      /work/SRC/openSUSE:Factory/.salt.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "salt"

Thu Nov 18 10:33:05 2021 rev:122 rq:931742 version:3003.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/salt/salt.changes        2021-10-16 
22:47:21.800677919 +0200
+++ /work/SRC/openSUSE:Factory/.salt.new.1895/salt.changes      2021-11-18 
10:33:20.711880133 +0100
@@ -1,0 +2,37 @@
+Mon Nov 15 15:14:54 UTC 2021 - Pablo Su??rez Hern??ndez 
<pablo.suarezhernan...@suse.com>
+
+- Simplify "transactional_update" module to not use SSH wrapper and allow more 
flexible execution
+- Add "--no-return-event" option to salt-call to prevent sending return event 
back to master.
+- Make "state.highstate" to acts on concurrent flag.
+- Fix print regression for yumnotify plugin
+
+- Added:
+  * refactor-and-improvements-for-transactional-updates-.patch
+  * fix-the-regression-for-yumnotify-plugin-456.patch
+
+-------------------------------------------------------------------
+Tue Nov  9 08:07:14 UTC 2021 - Victor Zhestkov <victor.zhest...@suse.com>
+
+- Use dnfnotify instead yumnotify for relevant distros
+- dnfnotify pkgset plugin implementation
+- Add rpm_vercmp python library support for version comparison
+- Prevent pkg plugins errors on missing cookie path (bsc#1186738)
+
+- Added:
+  * add-rpm_vercmp-python-library-for-version-comparison.patch
+  * mock-ip_addrs-in-utils-minions.py-unit-test-443.patch
+  * dnfnotify-pkgset-plugin-implementation-3002.2-450.patch
+  * fix-traceback.print_exc-calls-for-test_pip_state-432.patch
+  * prevent-pkg-plugins-errors-on-missing-cookie-path-bs.patch
+
+-------------------------------------------------------------------
+Fri Oct 15 15:06:25 UTC 2021 - Pablo Su??rez Hern??ndez 
<pablo.suarezhernan...@suse.com>
+
+- Fix ip6_interface grain to not leak secondary IPv4 aliases (bsc#1191412)
+- Make "salt-api" package to require python3-cherrypy on RHEL systems
+- Make "tar" as required for "salt-transactional-update" package
+
+- Added:
+  * fix-ip6_interface-grain-to-not-leak-secondary-ipv4-a.patch
+
+-------------------------------------------------------------------

New:
----
  add-rpm_vercmp-python-library-for-version-comparison.patch
  dnfnotify-pkgset-plugin-implementation-3002.2-450.patch
  fix-ip6_interface-grain-to-not-leak-secondary-ipv4-a.patch
  fix-the-regression-for-yumnotify-plugin-456.patch
  fix-traceback.print_exc-calls-for-test_pip_state-432.patch
  mock-ip_addrs-in-utils-minions.py-unit-test-443.patch
  prevent-pkg-plugins-errors-on-missing-cookie-path-bs.patch
  refactor-and-improvements-for-transactional-updates-.patch

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

Other differences:
------------------
++++++ salt.spec ++++++
--- /var/tmp/diff_new_pack.iS3e6X/_old  2021-11-18 10:33:21.899881238 +0100
+++ /var/tmp/diff_new_pack.iS3e6X/_new  2021-11-18 10:33:21.903881242 +0100
@@ -293,6 +293,22 @@
 Patch72:        fix-crash-when-calling-manage.not_alive-runners.patch
 # PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/61014
 Patch73:        fix-issues-with-salt-ssh-s-extra-filerefs.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61061
+Patch74:        fix-ip6_interface-grain-to-not-leak-secondary-ipv4-a.patch
+# PATCH-FIX_OPENSUSE https://github.com/openSUSE/salt/pull/432 (missing 
upstream PR)
+Patch75:        fix-traceback.print_exc-calls-for-test_pip_state-432.patch
+# PATCH-FIX_OPENSUSE https://github.com/openSUSE/salt/pull/415 (missing 
upstream PR)
+Patch76:        prevent-pkg-plugins-errors-on-missing-cookie-path-bs.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60815
+Patch77:        add-rpm_vercmp-python-library-for-version-comparison.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61180
+Patch78:        dnfnotify-pkgset-plugin-implementation-3002.2-450.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60324
+Patch79:        mock-ip_addrs-in-utils-minions.py-unit-test-443.patch
+# PATCH-FIX_OPENSUSE https://github.com/openSUSE/salt/pull/456 (missing 
upstream PR)
+Patch80:        fix-the-regression-for-yumnotify-plugin-456.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61188
+Patch81:        refactor-and-improvements-for-transactional-updates-.patch
 
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -483,7 +499,11 @@
 Group:          System/Management
 Requires:       %{name} = %{version}-%{release}
 Requires:       %{name}-master = %{version}-%{release}
+%if 0%{?suse_version}
 Requires:       python3-CherryPy >= 3.2.2
+%else
+Requires:       python3-cherrypy >= 3.2.2
+%endif
 
 %description api
 salt-api is a modular interface on top of Salt that can provide a variety of 
entry points into a running Salt system.
@@ -696,6 +716,7 @@
 Group:          System/Management
 Requires:       %{name} = %{version}-%{release}
 Requires:       %{name}-minion = %{version}-%{release}
+Requires:       tar
 
 %description transactional-update
 For transactional systems, like MicroOS, Salt can operate
@@ -781,6 +802,14 @@
 %patch71 -p1
 %patch72 -p1
 %patch73 -p1
+%patch74 -p1
+%patch75 -p1
+%patch76 -p1
+%patch77 -p1
+%patch78 -p1
+%patch79 -p1
+%patch80 -p1
+%patch81 -p1
 
 %build
 # Putting /usr/bin at the front of $PATH is needed for RHEL/RES 7. Without this
@@ -864,10 +893,22 @@
 
 # Install Yum plugins only on RH machines
 %if 0%{?fedora} || 0%{?rhel}
+%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
+install -Dd %{buildroot}%{python3_sitelib}/dnf-plugins
+install -Dd %{buildroot}%{python3_sitelib}/dnf-plugins/__pycache__
+install -Dd %{buildroot}%{_sysconfdir}/dnf/plugins
+%{__install} scripts/suse/dnf/plugins/dnfnotify.py 
%{buildroot}%{python3_sitelib}/dnf-plugins
+%{__install} scripts/suse/dnf/plugins/dnfnotify.conf 
%{buildroot}%{_sysconfdir}/dnf/plugins
+%{__python3} -m compileall -d %{python3_sitelib}/dnf-plugins 
%{buildroot}%{python3_sitelib}/dnf-plugins/dnfnotify.py
+%{__python3} -O -m compileall -d %{python3_sitelib}/dnf-plugins 
%{buildroot}%{python3_sitelib}/dnf-plugins/dnfnotify.py
+%else
 install -Dd %{buildroot}%{_prefix}/share/yum-plugins
-install -Dd %{buildroot}/etc/yum/pluginconf.d
+install -Dd %{buildroot}%{_sysconfdir}/yum/pluginconf.d
 %{__install} scripts/suse/yum/plugins/yumnotify.py 
%{buildroot}%{_prefix}/share/yum-plugins
-%{__install} scripts/suse/yum/plugins/yumnotify.conf 
%{buildroot}/etc/yum/pluginconf.d
+%{__install} scripts/suse/yum/plugins/yumnotify.conf 
%{buildroot}%{_sysconfdir}/yum/pluginconf.d
+%{__python} -m compileall -d %{_prefix}/share/yum-plugins 
%{buildroot}%{_prefix}/share/yum-plugins/yumnotify.py
+%{__python} -O -m compileall -d %{_prefix}/share/yum-plugins 
%{buildroot}%{_prefix}/share/yum-plugins/yumnotify.py
+%endif
 %endif
 
 ## install init and systemd scripts
@@ -1323,8 +1364,14 @@
 
 # Install Yum plugins only on RH machines
 %if 0%{?fedora} || 0%{?rhel}
-%{_prefix}/share/yum-plugins/
-/etc/yum/pluginconf.d/yumnotify.conf
+%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
+%{python3_sitelib}/dnf-plugins/dnfnotify.py
+%{python3_sitelib}/dnf-plugins/__pycache__/dnfnotify.*
+%{_sysconfdir}/dnf/plugins/dnfnotify.conf
+%else
+%{_prefix}/share/yum-plugins/yumnotify.*
+%{_sysconfdir}/yum/pluginconf.d/yumnotify.conf
+%endif
 %endif
 
 %if %{with systemd}

++++++ _lastrevision ++++++
--- /var/tmp/diff_new_pack.iS3e6X/_old  2021-11-18 10:33:21.951881287 +0100
+++ /var/tmp/diff_new_pack.iS3e6X/_new  2021-11-18 10:33:21.951881287 +0100
@@ -1 +1 @@
-43d1aa8a46def69d5b6097d235e7c7a97d4635cf
\ No newline at end of file
+21e5e5ac757d79b2899ba18b18ae369d713013dd
\ No newline at end of file

++++++ add-rpm_vercmp-python-library-for-version-comparison.patch ++++++
++++ 1115 lines (skipped)

++++++ dnfnotify-pkgset-plugin-implementation-3002.2-450.patch ++++++
>From b1c213f171538890b3b61def25e4777bccfa64fe Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <35733135+vzhest...@users.noreply.github.com>
Date: Mon, 8 Nov 2021 18:09:53 +0300
Subject: [PATCH] dnfnotify pkgset plugin implementation - 3002.2 (#450)

* dnfnotify pkgset plugin implementation

* Fix failing check

* Add error reporting if not possible to save cookie

* Try to create dir if not exists

* Show the exception message instead of file name

* Fix isort
---
 scripts/suse/dnf/plugins/README.md      | 21 +++++++++
 scripts/suse/dnf/plugins/dnfnotify.conf |  2 +
 scripts/suse/dnf/plugins/dnfnotify.py   | 60 +++++++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 scripts/suse/dnf/plugins/README.md
 create mode 100644 scripts/suse/dnf/plugins/dnfnotify.conf
 create mode 100644 scripts/suse/dnf/plugins/dnfnotify.py

diff --git a/scripts/suse/dnf/plugins/README.md 
b/scripts/suse/dnf/plugins/README.md
new file mode 100644
index 0000000000..b19428608e
--- /dev/null
+++ b/scripts/suse/dnf/plugins/README.md
@@ -0,0 +1,21 @@
+## What it is
+
+Plugin which provides a notification mechanism to Salt, if DNF is
+used outside of it.
+
+## Installation
+
+Configuration files are going to:
+
+       `/etc/dnf/plugins/[name].conf`
+
+Plugin itself goes to:
+
+       `%{python_sitelib}/dnf-plugins/[name].py`
+       The path to dnf-plugins directory is Python version dependant.
+
+## Permissions
+
+User:  root
+Group: root
+Mode:  644
diff --git a/scripts/suse/dnf/plugins/dnfnotify.conf 
b/scripts/suse/dnf/plugins/dnfnotify.conf
new file mode 100644
index 0000000000..e7002aa3e9
--- /dev/null
+++ b/scripts/suse/dnf/plugins/dnfnotify.conf
@@ -0,0 +1,2 @@
+[main]
+enabled = 1
diff --git a/scripts/suse/dnf/plugins/dnfnotify.py 
b/scripts/suse/dnf/plugins/dnfnotify.py
new file mode 100644
index 0000000000..6e9df85f71
--- /dev/null
+++ b/scripts/suse/dnf/plugins/dnfnotify.py
@@ -0,0 +1,60 @@
+import hashlib
+import os
+
+import dnf
+from dnfpluginscore import _, logger
+
+
+class DnfNotifyPlugin(dnf.Plugin):
+    def __init__(self, base, cli):
+        super().__init__(base, cli)
+        self.base = base
+        self.cookie_file = "/var/cache/salt/minion/rpmdb.cookie"
+        if os.path.exists("/var/lib/rpm/rpmdb.sqlite"):
+            self.rpmdb_file = "/var/lib/rpm/rpmdb.sqlite"
+        else:
+            self.rpmdb_file = "/var/lib/rpm/Packages"
+
+    def transaction(self):
+        if "SALT_RUNNING" not in os.environ:
+            try:
+                ck_dir = os.path.dirname(self.cookie_file)
+                if not os.path.exists(ck_dir):
+                    os.makedirs(ck_dir)
+                with open(self.cookie_file, "w") as ck_fh:
+                    ck_fh.write(
+                        "{chksum} {mtime}\n".format(
+                            chksum=self._get_checksum(), 
mtime=self._get_mtime()
+                        )
+                    )
+            except OSError as e:
+                logger.error(_("Unable to save cookie file: %s"), e)
+
+    def _get_mtime(self):
+        """
+        Get the modified time of the RPM Database.
+
+        Returns:
+            Unix ticks
+        """
+        return (
+            os.path.exists(self.rpmdb_file)
+            and int(os.path.getmtime(self.rpmdb_file))
+            or 0
+        )
+
+    def _get_checksum(self):
+        """
+        Get the checksum of the RPM Database.
+
+        Returns:
+            hexdigest
+        """
+        digest = hashlib.sha256()
+        with open(self.rpmdb_file, "rb") as rpm_db_fh:
+            while True:
+                buff = rpm_db_fh.read(0x1000)
+                if not buff:
+                    break
+                digest.update(buff)
+        return digest.hexdigest()
-- 
2.33.1


++++++ fix-ip6_interface-grain-to-not-leak-secondary-ipv4-a.patch ++++++
>From 0571b8a6d0f4728e604bab9a8ef6f2123546671b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
 <psuarezhernan...@suse.com>
Date: Fri, 15 Oct 2021 13:08:53 +0100
Subject: [PATCH] Fix ip6_interface grain to not leak secondary IPv4
 addrs

---
 salt/grains/core.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/salt/grains/core.py b/salt/grains/core.py
index f79110124f..88f1d2c053 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -2537,7 +2537,11 @@ def ip6_interfaces():
                 iface_ips.append(inet["address"])
         for secondary in ifaces[face].get("secondary", []):
             if "address" in secondary:
-                iface_ips.append(secondary["address"])
+                try:
+                    socket.inet_pton(socket.AF_INET6, secondary["address"])
+                    iface_ips.append(secondary["address"])
+                except OSError:
+                    pass
         ret[face] = iface_ips
     return {"ip6_interfaces": ret}
 
-- 
2.33.0


++++++ fix-the-regression-for-yumnotify-plugin-456.patch ++++++
>From a33a7b2e8e477912548cfd24c0dff2c38c44eae8 Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <35733135+vzhest...@users.noreply.github.com>
Date: Tue, 9 Nov 2021 16:19:56 +0300
Subject: [PATCH] Fix the regression for yumnotify plugin (#456)

---
 scripts/suse/yum/plugins/yumnotify.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/suse/yum/plugins/yumnotify.py 
b/scripts/suse/yum/plugins/yumnotify.py
index 0d117e8946..cec5256d20 100644
--- a/scripts/suse/yum/plugins/yumnotify.py
+++ b/scripts/suse/yum/plugins/yumnotify.py
@@ -63,4 +63,4 @@ def posttrans_hook(conduit):
                     )
                 )
         except OSError as e:
-            print("Unable to save the cookie file: %s" % (e), file=sys.stderr)
+            sys.stderr.write("Unable to save the cookie file: %s\n" % (e))
-- 
2.33.1


++++++ fix-traceback.print_exc-calls-for-test_pip_state-432.patch ++++++
>From fba844fbaeb6203350944241a4ad0d7127a79bd5 Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <35733135+vzhest...@users.noreply.github.com>
Date: Mon, 8 Nov 2021 17:43:02 +0300
Subject: [PATCH] Fix traceback.print_exc calls for test_pip_state (#432)

---
 tests/unit/states/test_pip_state.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/unit/states/test_pip_state.py 
b/tests/unit/states/test_pip_state.py
index 914f62ff23..9e827dbf8a 100644
--- a/tests/unit/states/test_pip_state.py
+++ b/tests/unit/states/test_pip_state.py
@@ -439,15 +439,15 @@ class PipStateInstallationErrorTest(TestCase):
             import salt.states.pip_state
             salt.states.pip_state.InstallationError
         except ImportError as exc:
-            traceback.print_exc(exc, file=sys.stdout)
+            traceback.print_exc(file=sys.stdout)
             sys.stdout.flush()
             sys.exit(1)
         except AttributeError as exc:
-            traceback.print_exc(exc, file=sys.stdout)
+            traceback.print_exc(file=sys.stdout)
             sys.stdout.flush()
             sys.exit(2)
         except Exception as exc:
-            traceback.print_exc(exc, file=sys.stdout)
+            traceback.print_exc(file=sys.stdout)
             sys.stdout.flush()
             sys.exit(3)
         sys.exit(0)
-- 
2.33.1


++++++ mock-ip_addrs-in-utils-minions.py-unit-test-443.patch ++++++
>From 2ea56dd17378fe2f41de04a9c1786d27fec9a266 Mon Sep 17 00:00:00 2001
From: Alexander Graul <m...@agraul.de>
Date: Mon, 25 Oct 2021 10:31:10 +0200
Subject: [PATCH] Mock ip_addrs() in utils/minions.py unit test (#443)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previously the test used `salt.utils.network.ip_addrs()' in the same way
that the tested code did. This worked well as long as at least one IP
address was returned by `salt.utils.network.ip_addrs()'.

Since this is a unit test, it should not depend on the environment,
it should just work???, even if there are no real IP addresses assigned to
the system (or container) that runs the test.

Co-authored-by: Pablo Su??rez Hern??ndez <psuarezhernan...@suse.com>

Co-authored-by: Pablo Su??rez Hern??ndez <psuarezhernan...@suse.com>
---
 tests/pytests/unit/utils/test_minions.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tests/pytests/unit/utils/test_minions.py 
b/tests/pytests/unit/utils/test_minions.py
index 0b7a7d3928..5b0cd77216 100644
--- a/tests/pytests/unit/utils/test_minions.py
+++ b/tests/pytests/unit/utils/test_minions.py
@@ -8,15 +8,16 @@ def test_connected_ids():
     test ckminion connected_ids when
     local_port_tcp returns 127.0.0.1
     """
-    opts = {"publish_port": 4505}
+    opts = {"publish_port": 4505, "minion_data_cache": True}
     minion = "minion"
-    ip = salt.utils.network.ip_addrs()
-    mdata = {"grains": {"ipv4": ip, "ipv6": []}}
-    ckminions = salt.utils.minions.CkMinions({"minion_data_cache": True})
+    ips = {"203.0.113.1", "203.0.113.2"}
+    mdata = {"grains": {"ipv4": ips, "ipv6": []}}
+    patch_ip_addrs = patch("salt.utils.network.local_port_tcp", 
return_value=ips)
     patch_net = patch("salt.utils.network.local_port_tcp", 
return_value={"127.0.0.1"})
     patch_list = patch("salt.cache.Cache.list", return_value=[minion])
     patch_fetch = patch("salt.cache.Cache.fetch", return_value=mdata)
-    with patch.dict(ckminions.opts, opts):
-        with patch_net, patch_list, patch_fetch:
-            ret = ckminions.connected_ids()
-            assert ret == {minion}
+
+    ckminions = salt.utils.minions.CkMinions(opts)
+    with patch_net, patch_ip_addrs, patch_list, patch_fetch:
+        ret = ckminions.connected_ids()
+        assert ret == {minion}
-- 
2.33.1


++++++ prevent-pkg-plugins-errors-on-missing-cookie-path-bs.patch ++++++
>From ad5baab333cb80ce47e65605c47c8ca6fc6d4514 Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <35733135+vzhest...@users.noreply.github.com>
Date: Mon, 8 Nov 2021 17:42:36 +0300
Subject: [PATCH] Prevent pkg plugins errors on missing cookie path
 (bsc#1186738) - 3002.2 (#415)

* Prevent pkg plugins errors on missing cookie path (bsc#1186738)

* Narrowing down exception handling

* Modify for Python 3 only

* Fix yumnotify
---
 scripts/suse/dpkg/dpkgnotify                  | 18 ++++++++++++++---
 scripts/suse/yum/plugins/README.md            |  2 +-
 scripts/suse/yum/plugins/yumnotify.py         | 17 ++++++++++++----
 scripts/suse/zypper/plugins/commit/zyppnotify | 20 ++++++++++++-------
 4 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/scripts/suse/dpkg/dpkgnotify b/scripts/suse/dpkg/dpkgnotify
index d3ad3d2ba9..3d6d038a98 100644
--- a/scripts/suse/dpkg/dpkgnotify
+++ b/scripts/suse/dpkg/dpkgnotify
@@ -2,10 +2,12 @@
 
 import os
 import hashlib
+import sys
 
 CK_PATH = "/var/cache/salt/minion/dpkg.cookie"
 DPKG_PATH = "/var/lib/dpkg/status"
 
+
 def _get_mtime():
     """
     Get the modified time of the Package Database.
@@ -35,9 +37,19 @@ def dpkg_post_invoke():
     """
     Hook after the package installation transaction.
     """
-    if 'SALT_RUNNING' not in os.environ:
-        with open(CK_PATH, 'w') as ck_fh:
-            ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(), 
mtime=_get_mtime()))
+    if "SALT_RUNNING" not in os.environ:
+        try:
+            ck_dir = os.path.dirname(CK_PATH)
+            if not os.path.exists(ck_dir):
+                os.makedirs(ck_dir)
+            with open(CK_PATH, "w") as ck_fh:
+                ck_fh.write(
+                    "{chksum} {mtime}\n".format(
+                        chksum=_get_checksum(), mtime=_get_mtime()
+                    )
+                )
+        except OSError as e:
+            print("Unable to save the cookie file: %s" % (e), file=sys.stderr)
 
 
 if __name__ == "__main__":
diff --git a/scripts/suse/yum/plugins/README.md 
b/scripts/suse/yum/plugins/README.md
index cb3abd2260..3515845b31 100644
--- a/scripts/suse/yum/plugins/README.md
+++ b/scripts/suse/yum/plugins/README.md
@@ -11,7 +11,7 @@ Configuration files are going to:
 
 Plugin itself goes to:
 
-       `/usr/share/yum-plugins/[name].conf`
+       `/usr/share/yum-plugins/[name].py`
 
 ## Permissions
 
diff --git a/scripts/suse/yum/plugins/yumnotify.py 
b/scripts/suse/yum/plugins/yumnotify.py
index 4e137191a0..0d117e8946 100644
--- a/scripts/suse/yum/plugins/yumnotify.py
+++ b/scripts/suse/yum/plugins/yumnotify.py
@@ -5,6 +5,7 @@
 
 import hashlib
 import os
+import sys
 
 from yum.plugins import TYPE_CORE
 
@@ -51,7 +52,15 @@ def posttrans_hook(conduit):
     """
     # Integrate Yum with Salt
     if "SALT_RUNNING" not in os.environ:
-        with open(CK_PATH, "w") as ck_fh:
-            ck_fh.write(
-                "{chksum} {mtime}\n".format(chksum=_get_checksum(), 
mtime=_get_mtime())
-            )
+        try:
+            ck_dir = os.path.dirname(CK_PATH)
+            if not os.path.exists(ck_dir):
+                os.makedirs(ck_dir)
+            with open(CK_PATH, "w") as ck_fh:
+                ck_fh.write(
+                    "{chksum} {mtime}\n".format(
+                        chksum=_get_checksum(), mtime=_get_mtime()
+                    )
+                )
+        except OSError as e:
+            print("Unable to save the cookie file: %s" % (e), file=sys.stderr)
diff --git a/scripts/suse/zypper/plugins/commit/zyppnotify 
b/scripts/suse/zypper/plugins/commit/zyppnotify
index d6a1bef42b..e3528e87a9 100755
--- a/scripts/suse/zypper/plugins/commit/zyppnotify
+++ b/scripts/suse/zypper/plugins/commit/zyppnotify
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 #
 # Copyright (c) 2016 SUSE Linux LLC
 # All Rights Reserved.
@@ -52,15 +52,21 @@ class DriftDetector(Plugin):
 
     def PLUGINEND(self, headers, body):
         """
-        Hook when plugin closes Zypper's transaction.        
+        Hook when plugin closes Zypper's transaction.
         """
         if "SALT_RUNNING" not in os.environ:
-            with open(self.ck_path, "w") as ck_fh:
-                ck_fh.write(
-                    "{chksum} {mtime}\n".format(
-                        chksum=self._get_checksum(), mtime=self._get_mtime()
+            try:
+                ck_dir = os.path.dirname(self.ck_path)
+                if not os.path.exists(ck_dir):
+                    os.makedirs(ck_dir)
+                with open(self.ck_path, "w") as ck_fh:
+                    ck_fh.write(
+                        "{chksum} {mtime}\n".format(
+                            chksum=self._get_checksum(), 
mtime=self._get_mtime()
+                        )
                     )
-                )
+            except OSError as e:
+                print("Unable to save the cookie file: %s" % (e), 
file=sys.stderr)
 
         self.ack()
 
-- 
2.33.1


++++++ refactor-and-improvements-for-transactional-updates-.patch ++++++
++++ 1064 lines (skipped)

Reply via email to