File sles15.patch of Package cobbler.10419
diff -urN cobbler-2.6.6.orig/cobbler/action_reposync.py cobbler-2.6.6/cobbler/action_reposync.py
--- cobbler-2.6.6.orig/cobbler/action_reposync.py 2014-10-19 13:25:16.000000000 +0200
+++ cobbler-2.6.6/cobbler/action_reposync.py 2018-03-13 15:30:51.081514926 +0100
@@ -625,7 +625,7 @@
"""
# 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
diff -urN cobbler-2.6.6.orig/cobbler/utils.py cobbler-2.6.6/cobbler/utils.py
--- cobbler-2.6.6.orig/cobbler/utils.py 2018-03-13 15:13:42.473817669 +0100
+++ cobbler-2.6.6/cobbler/utils.py 2018-03-13 15:24:01.052033141 +0100
@@ -1040,14 +1040,26 @@
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=") != -1:
+ version = line.replace("VERSION=", "").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)
diff -urN cobbler-2.6.6.orig/koan/utils.py cobbler-2.6.6/koan/utils.py
--- cobbler-2.6.6.orig/koan/utils.py 2018-03-13 15:13:42.437817543 +0100
+++ cobbler-2.6.6/koan/utils.py 2018-03-13 15:13:57.509870222 +0100
@@ -337,6 +337,13 @@
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 @@
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=") != -1:
+ version = line.replace("VERSION=", "").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 = {}