diff options
| author | Suhail Syed <suhail.syed@gmail.com> | 2015-08-24 15:58:33 -0700 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-08-25 06:46:15 +0000 |
| commit | bd8d795124625e86ed4287a739101d28e6207eaf (patch) | |
| tree | cda4907d80832524610725790af60e4504af4793 | |
| parent | d3872aa9eeeb1b254c66c2de486d3815d1ca48ad (diff) | |
| download | kolla-bd8d795124625e86ed4287a739101d28e6207eaf.tar.gz kolla-bd8d795124625e86ed4287a739101d28e6207eaf.zip | |
Modified build.py to run from installed location
Modified build.py to run from installed location or developer
environment. To run from development environment, run the
command:
sudo pip install -e .
Additionally, remove a TODO that has been done
Co-Authored-By: Sam Yaple <sam@yaple.net>
Change-Id: I922696ba439da2c9747e65cddcba47203e54d220
Implements: blueprint python-package
| -rwxr-xr-x | kolla/cmd/build.py | 24 | ||||
| l--------- | tools/build.py | 1 |
2 files changed, 20 insertions, 5 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index 4f571c790..243ec77f7 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO(SamYaple): Single image building w/ optional parent building # TODO(jpeeler): Add clean up handler for SIGINT import argparse @@ -41,6 +40,10 @@ LOG.setLevel(logging.INFO) signal.signal(signal.SIGINT, signal.SIG_DFL) +class KollaDirNotFoundException(Exception): + pass + + class WorkerThread(Thread): def __init__(self, queue, args): @@ -189,9 +192,20 @@ def argParser(): class KollaWorker(object): def __init__(self, args): - self.kolla_dir = os.path.join(sys.path[0], '..') - self.images_dir = os.path.join(self.kolla_dir, 'docker') - self.templates_dir = os.path.join(self.kolla_dir, 'docker_templates') + def find_base_dir(): + if os.path.basename(sys.path[0]) == 'tests': + return os.path.join(sys.path[0], '..') + if os.path.basename(sys.path[0]) == 'cmd': + return os.path.join(sys.path[0], '..', '..') + if os.path.basename(sys.path[0]) == 'bin': + return '/usr/share/kolla' + raise KollaDirNotFoundException( + 'I do not know where your Kolla directory is' + ) + + self.base_dir = find_base_dir() + self.images_dir = os.path.join(self.base_dir, 'docker') + self.templates_dir = os.path.join(self.base_dir, 'docker_templates') self.namespace = args['namespace'] self.template = args['template'] self.base = args['base'] @@ -200,7 +214,7 @@ class KollaWorker(object): self.tag = args['tag'] self.prefix = self.base + '-' + self.type_ + '-' self.config = ConfigParser.SafeConfigParser() - self.config.read(os.path.join(sys.path[0], '..', 'build.ini')) + self.config.read(os.path.join(sys.path[0], self.base_dir, 'build.ini')) self.include_header = args['include_header'] self.regex = args['regex'] diff --git a/tools/build.py b/tools/build.py new file mode 120000 index 000000000..285d9d660 --- /dev/null +++ b/tools/build.py @@ -0,0 +1 @@ +../kolla/cmd/build.py
\ No newline at end of file |
