dovetail tool: os name bugfix 13/24013/3
authorMatthewLi <matthew.lijun@huawei.com>
Mon, 7 Nov 2016 08:03:06 +0000 (03:03 -0500)
committerMatthewLi <matthew.lijun@huawei.com>
Tue, 8 Nov 2016 02:34:52 +0000 (21:34 -0500)
JIRA: DOVETAIL-54

bug: in some envs, return value platform_os is Ubuntu rather than ubuntu.

Change-Id: I6a2aa964d00eff9f336f8204071a05a6b5f11134
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
dovetail/prepare_env.py

index 3e4d696..7573fb6 100644 (file)
@@ -12,12 +12,13 @@ import utils.dovetail_logger as dt_logger
 import utils.dovetail_utils as dt_utils
 
 
-def get_os():
+def get_os_lower():
     """Get distro name.
 
     :returns: return distro name as a string
     """
-    return platform.dist()[0]
+    platform_os = platform.dist()[0]
+    return platform_os.lower()
 
 
 def get_install_bin(os):
@@ -49,7 +50,7 @@ def get_docker_pkgname(os):
 
 logger = dt_logger.Logger('prepare_env.py').getLogger()
 
-os_name = get_os()
+os_name = get_os_lower()
 cmd = "sudo %s -y install %s python-pip" \
       % (get_install_bin(os_name), get_docker_pkgname(os_name))
 dt_utils.exec_cmd(cmd, logger)