diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-09-04 06:24:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-09-04 06:24:28 +0000 |
| commit | 91bc4b094c79f75b8c9eb54769571f4f4c03cc11 (patch) | |
| tree | 39101fd0fb16fc07f9ae31a919eddec749aa78e7 /kolla/cmd | |
| parent | d799f819d4e32fa19abbecb403cbb14a0631a1c1 (diff) | |
| parent | c22cf33268979db15f06f2bab347750127e5d7ee (diff) | |
| download | kolla-91bc4b094c79f75b8c9eb54769571f4f4c03cc11.tar.gz kolla-91bc4b094c79f75b8c9eb54769571f4f4c03cc11.zip | |
Merge "Allow arbitrary source archive name to be imported into Dockerfile"
Diffstat (limited to 'kolla/cmd')
| -rwxr-xr-x | kolla/cmd/build.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index 17142b54b..437f19cc4 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -88,27 +88,25 @@ class WorkerThread(Thread): def process_source(self, image): source = image['source'] - dest_dir = image['path'] - dest_tar = os.path.join(dest_dir, image['name'] + '.tar') + dest_archive = os.path.join(image['path'], image['name'] + '-archive') if source.get('type') == 'url': - LOG.debug("{}:Getting tarball from {}".format(image['name'], + LOG.debug("{}:Getting archive from {}".format(image['name'], source['source'])) r = requests.get(source['source']) if r.status_code == 200: - with open(dest_tar, 'wb') as f: + with open(dest_archive, 'wb') as f: f.write(r.content) else: LOG.error( - '{}:Failed to download tarball: status_code {}'.format( + '{}:Failed to download archive: status_code {}'.format( image['name'], r.status_code)) image['status'] = "error" return elif source.get('type') == 'git': - clone_dir = os.path.splitext(dest_tar)[0] + \ - '-' + source['reference'] + clone_dir = dest_archive + '-' + source['reference'] try: LOG.debug("{}:Cloning from {}".format(image['name'], source['source'])) @@ -125,7 +123,7 @@ class WorkerThread(Thread): image['status'] = "error" return - with tarfile.open(dest_tar, 'w') as tar: + with tarfile.open(dest_archive, 'w') as tar: tar.add(clone_dir, arcname=os.path.basename(clone_dir)) else: @@ -134,8 +132,8 @@ class WorkerThread(Thread): image['status'] = "error" return - # Set time on destination tarball to epoch 0 - os.utime(dest_tar, (0, 0)) + # Set time on destination archive to epoch 0 + os.utime(dest_archive, (0, 0)) def builder(self, image): LOG.debug('{}:Processing'.format(image['name'])) |
