diff options
| author | Kirill Proskurin <kproskurin@mirantis.com> | 2015-11-02 13:49:42 +0300 |
|---|---|---|
| committer | Proskurin Kirill <kproskurin@mirantis.com> | 2015-11-06 14:03:30 +0300 |
| commit | 396014f8d10b4821adc69ed5c4869309b76147d4 (patch) | |
| tree | d0a23308a6a1bcc989bda72bbc6b431f5b4946e0 | |
| parent | efab0314e9a19dfa179b2ca02dd9a6f18c352295 (diff) | |
| download | kolla-396014f8d10b4821adc69ed5c4869309b76147d4.tar.gz kolla-396014f8d10b4821adc69ed5c4869309b76147d4.zip | |
Few improvements in Kolla tools. Added Ubuntu support.
pip install default prefix in Ubuntu is /usr/local, and Kolla tools scripts
didnt respect that. So I added few OS checks in this scripts.
I improve config path check in build.py. Added more verbose error if we can't
find config directory.
Change-Id: Ide521ed205b0dc1fc27e237a9a8f4da0168e664f
Closes-Bug: #1512302
| -rwxr-xr-x | kolla/cmd/build.py | 27 | ||||
| -rwxr-xr-x | tools/kolla-ansible | 2 |
2 files changed, 22 insertions, 7 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index 94da59e6f..350d91288 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -20,6 +20,7 @@ import datetime import json import logging import os +import platform import Queue import re import requests @@ -189,12 +190,19 @@ class WorkerThread(Thread): LOG.info('{}:Built'.format(image['name'])) +def find_os_type(): + return platform.linux_distribution() + + def find_base_dir(): script_path = os.path.dirname(os.path.realpath(sys.argv[0])) if os.path.basename(script_path) == 'cmd': return os.path.join(script_path, '..', '..') if os.path.basename(script_path) == 'bin': - return '/usr/share/kolla' + if find_os_type()[0] in ['Ubuntu', 'debian']: + return '/usr/local/share/kolla' + else: + return '/usr/share/kolla' if os.path.exists(os.path.join(script_path, 'tests')): return script_path raise KollaDirNotFoundException( @@ -203,13 +211,18 @@ def find_base_dir(): def find_config_file(filename): - filepath = os.path.join('/etc/kolla', filename) - if os.access(filepath, os.R_OK): - config_file = filepath + global_conf_path = os.path.join('/etc/kolla', filename) + local_conf_path = os.path.join(find_base_dir(), 'etc', 'kolla', filename) + + if os.access(global_conf_path, os.R_OK): + return global_conf_path + elif os.access(local_conf_path, os.R_OK): + return local_conf_path else: - config_file = os.path.join(find_base_dir(), - 'etc', 'kolla', filename) - return config_file + raise KollaDirNotFoundException( + 'Cant find kolla config. Searched at: %s and %s' % + (global_conf_path, local_conf_path) + ) def merge_args_and_config(settings_from_config_file): diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 573158df0..d24941193 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -7,6 +7,8 @@ function find_base_dir { local dir_name="$(dirname "$real_path")" if [[ ${dir_name} == "/usr/bin" ]]; then BASEDIR=/usr/share/kolla + elif [[ ${dir_name} == "/usr/local/bin" ]]; then + BASEDIR=/usr/local/share/kolla else BASEDIR="${dir_name}/.." fi |
