summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2016-11-10 07:30:15 +0000
committerxudan <xudan16@huawei.com>2016-11-14 03:48:15 +0000
commitd2a1c76600a358397fef02d13726916390c2b2f1 (patch)
tree4f4f60fb68d4a532daaebd0b35489b217e480e1d
parentcd7b2cdaef7226165e511337858f10279652104d (diff)
dovetail tool: reorganize prepare_env.py
1. add main function and move statements into it JIRA: DOVETAIL-57 Change-Id: I69158fa64ffc10668fc39835de434f0b44b8754a Signed-off-by: xudan <xudan16@huawei.com>
-rw-r--r--dovetail/prepare_env.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/dovetail/prepare_env.py b/dovetail/prepare_env.py
index 7573fb6e..9cf0f4f0 100644
--- a/dovetail/prepare_env.py
+++ b/dovetail/prepare_env.py
@@ -8,6 +8,7 @@
#
import platform
+
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
@@ -48,12 +49,19 @@ def get_docker_pkgname(os):
else:
return None
-logger = dt_logger.Logger('prepare_env.py').getLogger()
-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)
+def main():
+ """Dovetail prepare env main"""
+ logger = dt_logger.Logger('prepare_env.py').getLogger()
+
+ 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)
+
+ cmd = "sudo pip install click pyyaml jinja2"
+ dt_utils.exec_cmd(cmd, logger)
+
-cmd = "sudo pip install click pyyaml jinja2"
-dt_utils.exec_cmd(cmd, logger)
+if __name__ == '__main__':
+ main()