]> xenbits.xensource.com Git - xenrt-citrix/xenrt.git/commitdiff
Fix up some OS detection issues
authorJohn Dilley <john.dilley@citrix.com>
Fri, 20 Nov 2015 15:57:22 +0000 (15:57 +0000)
committerJohn Dilley <john.dilley@citrix.com>
Fri, 20 Nov 2015 16:02:04 +0000 (16:02 +0000)
exec/xenrt/lib/opsys/debian.py
exec/xenrt/lib/opsys/rhel.py

index 303e32037702de1f69f53b507280b8e4b226f13b..5c3467d5b778507a5b758b96d6834429f8631027 100644 (file)
@@ -214,7 +214,7 @@ class DebianLinux(DebianBasedLinux):
         else:
             release = obj.execSSH("cat /etc/debian_version").strip()
             release = release.split(".")[0]
-            if re.match("^debian\d+$", release):
+            if re.match("^\d+$", release):
                 return cls("debian%s0_%s" % (release, obj.getArch()), parent, obj.password)
             else:
                 raise OSNotDetected("Couldn't determine Debian version")
@@ -249,7 +249,7 @@ class UbuntuLinux(DebianBasedLinux):
             raise OSNotDetected("OS is not Ubuntu")
         else:
             release = obj.execSSH("cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d = -f 2 | tr -d .")
-            if re.match("^ubuntu\d+$", release):
+            if re.match("^\d+$", release):
                 return cls("ubuntu%s0_%s" % (release, obj.getArch()), parent, obj.password)
             else:
                 raise OSNotDetected("Could not determine Ubuntu version")
index d341ce1e857bacfb2d0e7380d22e18a4965fb6b4..44da6da337631e5a6c21a1291c549e08db2b1fea 100644 (file)
@@ -247,6 +247,8 @@ class CentOSLinux(RHELBasedLinux):
                     "sed 's/CentOS release /centos/' | "
                     "sed 's/CentOS Linux release /centos/' | "
                     "awk '{print $1}'").strip()
+        if not distro.startswith("centos"):
+            raise OSNotDetected("OS it not CentOS")
         dd = distro.split(".")
         distro = dd[0]
         if dd[1] != "0":