aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-10 02:20:24 +0000
committerGerrit Code Review <review@openstack.org>2016-03-10 02:20:24 +0000
commit5d8851c7c4cffdcd05fc982910f47e28e892b7c5 (patch)
tree1911d0cdf556cdd5351e32e5c37662c3c72114e8
parenta84bc980a1cb9344ca2f533ed3b8a195c3df768c (diff)
parent279594ab6456694de883f0a6873de65d41e0ca8f (diff)
downloadkolla-5d8851c7c4cffdcd05fc982910f47e28e892b7c5.tar.gz
kolla-5d8851c7c4cffdcd05fc982910f47e28e892b7c5.zip
Merge "Add local directory or file for source build"
-rwxr-xr-xkolla/cmd/build.py10
-rw-r--r--kolla/common/config.py2
2 files changed, 11 insertions, 1 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index d21109647..1bb8d8076 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -208,6 +208,16 @@ class WorkerThread(threading.Thread):
with tarfile.open(dest_archive, 'w') as tar:
tar.add(clone_dir, arcname=os.path.basename(clone_dir))
+ elif source.get('type') == 'local':
+ LOG.debug("%s:Getting local archive from %s", image['name'],
+ source['source'])
+ if os.path.isdir(source['source']):
+ with tarfile.open(dest_archive, 'w') as tar:
+ tar.add(source['source'],
+ arcname=os.path.basename(source['source']))
+ else:
+ shutil.copyfile(source['source'], dest_archive)
+
else:
LOG.error("%s:Wrong source type '%s'", image['name'],
source.get('type'))
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 2eeb8c9ca..3816230af 100644
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -241,7 +241,7 @@ SOURCES = {
def get_source_opts(type_=None, location=None, reference=None):
- return [cfg.StrOpt('type', choices=['git', 'url'],
+ return [cfg.StrOpt('type', choices=['local', 'git', 'url'],
default=type_,
help='Source location type'),
cfg.StrOpt('location', default=location,