]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
misc.get_system_type(): fix distro=False version=True, add comments
authorDan Mick <dan.mick@redhat.com>
Wed, 3 Dec 2014 03:07:01 +0000 (19:07 -0800)
committerDan Mick <dan.mick@redhat.com>
Thu, 4 Dec 2014 01:02:48 +0000 (17:02 -0800)
Fixes: #10237
Signed-off-by: Dan Mick <dan.mick@redhat.com>
teuthology/misc.py

index ae849da82c5bc253421c46127439947506eb0262..52d850e1f01b22100727adb3680130ca5d153c0f 100644 (file)
@@ -1093,7 +1093,11 @@ def stop_daemons_of_type(ctx, type_):
 
 def get_system_type(remote, distro=False, version=False):
     """
-    Return this system type (deb or rpm) or Distro.
+    If distro, return distro.
+    If version, return version (lsb_release -rs)
+    If both, return both.
+    If neither, return 'deb' or 'rpm' if distro is known to be one of those
+    Finally, if unknown, return the unfiltered distro (from lsb_release -is)
     """
     r = remote.run(
         args=[
@@ -1110,13 +1114,13 @@ def get_system_type(remote, distro=False, version=False):
         return system_value.lower(), version
     if distro:
         return system_value.lower()
+    if version:
+        return version
     if system_value in ['Ubuntu', 'Debian']:
         return "deb"
     if system_value in ['CentOS', 'Fedora', 'RedHatEnterpriseServer',
                         'openSUSE project', 'SUSE LINUX']:
         return "rpm"
-    if version:
-        return version
     return system_value