Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cobbler for openSUSE:Factory checked 
in at 2021-06-01 10:35:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cobbler (Old)
 and      /work/SRC/openSUSE:Factory/.cobbler.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cobbler"

Tue Jun  1 10:35:45 2021 rev:63 rq:895374 version:3.2.1+git20210315.f7482f6b

Changes:
--------
--- /work/SRC/openSUSE:Factory/cobbler/cobbler.changes  2021-05-04 
22:00:51.628629693 +0200
+++ /work/SRC/openSUSE:Factory/.cobbler.new.1898/cobbler.changes        
2021-06-01 10:36:26.868709473 +0200
@@ -1,0 +2,9 @@
+Tue May 18 12:01:22 UTC 2021 - Pablo Su??rez Hern??ndez 
<pablo.suarezhernan...@suse.com>
+
+- Prevent some race conditions when writting tftpboot files and
+  the destination directory is not existing (bsc#1186124)
+
+- Added:
+  * prevent-race-condition-writting-tftpboot-files-bsc1186124.patch
+
+-------------------------------------------------------------------

New:
----
  prevent-race-condition-writting-tftpboot-files-bsc1186124.patch

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

Other differences:
------------------
++++++ cobbler.spec ++++++
--- /var/tmp/diff_new_pack.UbEhJ0/_old  2021-06-01 10:36:27.376710337 +0200
+++ /var/tmp/diff_new_pack.UbEhJ0/_new  2021-06-01 10:36:27.380710345 +0200
@@ -164,6 +164,7 @@
 Source0:        %{name}-%{version}.tar.gz
 Source1:        %{name}.rpmlintrc
 BuildArch:      noarch
+Patch0:         prevent-race-condition-writting-tftpboot-files-bsc1186124.patch
 
 BuildRequires:  git-core
 BuildRequires:  %{system_release_pkg}
@@ -278,6 +279,7 @@
 
 %prep
 %setup
+%patch0 -p1
 
 %if 0%{?suse_version}
 # Set tftpboot location correctly for SUSE distributions

++++++ prevent-race-condition-writting-tftpboot-files-bsc1186124.patch ++++++
>From adf4ce65d50d2385b8d1491dfa88e558fcb1c4c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
 <psuarezhernan...@suse.com>
Date: Tue, 18 May 2021 12:43:32 +0100
Subject: [PATCH] Prevent some race conditions when writting tftpboot files

---
 cobbler/tftpgen.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

Index: cobbler-3.2.1+git20210315.f7482f6b/cobbler/tftpgen.py
===================================================================
--- cobbler-3.2.1+git20210315.f7482f6b.orig/cobbler/tftpgen.py
+++ cobbler-3.2.1+git20210315.f7482f6b/cobbler/tftpgen.py
@@ -290,6 +290,8 @@ class TFTPGen:
                         link_path = os.path.join(self.bootloc, "grub", 
"system_link", system.name)
                         if os.path.exists(link_path):
                             utils.rmfile(link_path)
+                        if not os.path.exists(os.path.dirname(link_path)):
+                            utils.mkdir(os.path.dirname(link_path))
                         os.symlink(os.path.join("..", "system", grub_name), 
link_path)
                 else:
                     self.write_pxe_file(pxe_path, system, None, None, 
working_arch, image=profile, metadata=pxe_metadata)
@@ -614,17 +616,11 @@ class TFTPGen:
 
         if filename is not None:
             self.logger.info("generating: %s" % filename)
-            # This try-except is a work-around for the cases where 'open' 
throws
-            # the FileNotFoundError for not apparent reason.
-            try:
-                with open(filename, "w") as fd:
-                    fd.write(buffer)
-            except FileNotFoundError as e:
-                self.logger.error("Got \"{}\" while trying to write 
{}".format(e, filename))
-                self.logger.error("Trying to write {} again after some 
delay.".format(filename))
-                sleep(1)
-                with open(filename, "w") as fd:
-                    fd.write(buffer)
+            # Ensure destination path exists to avoid race condition
+            if not os.path.exists(os.path.dirname(filename)):
+                utils.mkdir(os.path.dirname(filename))
+            with open(filename, "w") as fd:
+                fd.write(buffer)
         return buffer
 
     def build_kernel_options(self, system, profile, distro, image, arch: str, 
autoinstall_path) -> str:

Reply via email to