diff options
author | 2017-01-16 03:10:16 +0000 | |
---|---|---|
committer | 2017-01-16 03:10:16 +0000 | |
commit | 69845ee8f5301bdaadd3d37d23153d4423a8e92e (patch) | |
tree | 9859a8ed2ffbe8e41c43112aa28273c2fb1823e1 /dovetail/prepare_env.py | |
parent | e97456e126db10e8ba261f60956e0032a492d7e6 (diff) | |
parent | 96d20285b164ddda94acad4253015e7125fe8337 (diff) |
Merge "dovetail tool: delete unnecessary prepare_env.py"
Diffstat (limited to 'dovetail/prepare_env.py')
-rw-r--r-- | dovetail/prepare_env.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/dovetail/prepare_env.py b/dovetail/prepare_env.py deleted file mode 100644 index 3ddf75bc..00000000 --- a/dovetail/prepare_env.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -# grakiss.wanglei@huawei.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# - -import platform - -import utils.dovetail_utils as dt_utils - - -def get_os_lower(): - """Get distro name. - - :returns: return distro name as a string - """ - platform_os = platform.dist()[0] - return platform_os.lower() - - -def get_install_bin(os): - """Get install command binary. - - :returns: return install command according to distro - """ - if os in ['centos', 'redhat']: - return 'yum' - elif os == 'fedora': - return 'dnf' - elif os == 'ubuntu': - return 'apt-get' - else: - return None - - -def get_docker_pkgname(os): - """Get docker package name. - - :returns: return docker package name according to distro - """ - if os in ['centos', 'fedora', 'redhat']: - return 'docker' - elif os == 'ubuntu': - return 'docker.io' - else: - return None - - -def main(): - """Dovetail prepare env main""" - - 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) - - cmd = "sudo pip install click pyyaml jinja2" - dt_utils.exec_cmd(cmd) - - -if __name__ == '__main__': - main() |