File sles15.patch of Package cobbler.15445

Index: cobbler-2.6.6/cobbler/action_reposync.py
===================================================================
--- cobbler-2.6.6.orig/cobbler/action_reposync.py
+++ cobbler-2.6.6/cobbler/action_reposync.py
@@ -625,7 +625,7 @@ class RepoSync:
         """
         # all_path = os.path.join(repo_path, "*")
         owner = "root:apache"
-        if os.path.exists("/etc/SuSE-release"):
+        if utils.check_dist() in ("suse","opensuse"):
             owner = "root:www"
 
         cmd1 = "chown -R "+owner+" %s" % repo_path
Index: cobbler-2.6.6/cobbler/utils.py
===================================================================
--- cobbler-2.6.6.orig/cobbler/utils.py
+++ cobbler-2.6.6/cobbler/utils.py
@@ -1040,14 +1040,26 @@ def os_release():
       make = "ubuntu"
       return (make, float(version))
    elif (re.match("suse", check_dist())) or (re.match("opensuse", check_dist())):
-      fd = open("/etc/SuSE-release")
-      for line in fd.read().split("\n"):
-         if line.find("VERSION") != -1:
-            version = line.replace("VERSION = ","")
-         if line.find("PATCHLEVEL") != -1:
-            rest = line.replace("PATCHLEVEL = ","")
-      make = "suse"
-      return (make, float(version))
+      if os.path.exists("/etc/SuSE-release"):
+         fd = open("/etc/SuSE-release")
+         for line in fd.read().split("\n"):
+            if line.find("VERSION") != -1:
+               version = line.replace("VERSION = ", "")
+            if line.find("PATCHLEVEL") != -1:
+               rest = line.replace("PATCHLEVEL = ", "")
+         make = "suse"
+         return (make, float(version))
+      elif os.path.exists("/etc/os-release"):
+         fd = open("/etc/os-release")
+         for line in fd.read().split("\n"):
+            if line.find("VERSION_ID=") != -1:
+               version = line.replace("VERSION_ID=", "").strip('"')
+            if line.find("PATCHLEVEL") != -1:
+               rest = line.replace("PATCHLEVEL=", "").strip('"')
+         make = "suse"
+         return (make, float(version))
+      else:
+         return ("unknown", 0)
    else:
       return ("unknown",0)
 
Index: cobbler-2.6.6/koan/utils.py
===================================================================
--- cobbler-2.6.6.orig/koan/utils.py
+++ cobbler-2.6.6/koan/utils.py
@@ -337,6 +337,13 @@ def check_dist():
        return lsb_release.get_distro_information()['ID'].lower()
     elif os.path.exists("/etc/SuSE-release"):
        return "suse"
+    elif os.path.exists("/etc/os-release"):
+       fh = open("/etc/os-release")
+       data = fh.read().lower()
+       if data.find("suse") != -1:
+          return "suse"
+       else:
+          return "redhat"
     else:
        # valid for Fedora and all Red Hat / Fedora derivatives
        return "redhat"
@@ -378,16 +385,28 @@ def os_release():
       make = "ubuntu"
       return (make, float(version))
    elif check_dist() in ("suse", "opensuse"):
-      fd = open("/etc/SuSE-release")
-      for line in fd.read().split("\n"):
-         if line.find("VERSION") != -1:
-            version = line.replace("VERSION = ","")
-         if line.find("PATCHLEVEL") != -1:
-            rest = line.replace("PATCHLEVEL = ","")
-      make = "suse"
-      return (make, float(version))
+      if os.path.exists("/etc/SuSE-release"):
+         fd = open("/etc/SuSE-release")
+         for line in fd.read().split("\n"):
+            if line.find("VERSION") != -1:
+               version = line.replace("VERSION = ", "")
+            if line.find("PATCHLEVEL") != -1:
+               rest = line.replace("PATCHLEVEL = ", "")
+         make = "suse"
+         return (make, float(version))
+      elif os.path.exists("/etc/os-release"):
+         fd = open("/etc/os-release")
+         for line in fd.read().split("\n"):
+            if line.find("VERSION_ID=") != -1:
+               version = line.replace("VERSION_ID=", "").strip('"')
+            if line.find("PATCHLEVEL") != -1:
+               rest = line.replace("PATCHLEVEL=", "").strip('"')
+         make = "suse"
+         return (make, float(version))
+      else:
+         return ("unknown", 0)
    else:
-      return ("unknown",0)
+      return ("unknown", 0)
 
 def uniqify(lst, purge=None):
    temp = {}
openSUSE Build Service is sponsored by