diff options
| author | Chris Suttles <suttles@gmail.com> | 2017-02-21 22:32:19 -0800 |
|---|---|---|
| committer | Chris Suttles <suttles@gmail.com> | 2017-02-23 10:33:03 -0800 |
| commit | 07101562e3eb477dbb1246f8c2097143de4e6327 (patch) | |
| tree | a806a1c6c2c2d53a293487eb31cba6dfbe48274c | |
| parent | 1fbe35815cf83b48d5ffda246ee7aff39931bce6 (diff) | |
| download | kolla-07101562e3eb477dbb1246f8c2097143de4e6327.tar.gz kolla-07101562e3eb477dbb1246f8c2097143de4e6327.zip | |
Improve kolla image build script for finding parent images
This change updates the image script to search for the parent image via the
Docker 'FROM' tag throughout the Dockerfile. The script previously checked
for parent name of an image, assuming that first line of Dockerfile always
starts with FROM, but that is not always the case when using custom
Dockerfiles.
Change-Id: I176d99f4e4896b64435e495526154c8f4c684839
Closes-Bug: #1656206
| -rwxr-xr-x | kolla/image/build.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index f7719d54f..133063513 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -885,8 +885,15 @@ class KollaWorker(object): image_name = os.path.basename(path) canonical_name = (self.namespace + '/' + self.image_prefix + image_name + ':' + self.tag) + parent_search_pattern = re.compile(r'^FROM.*$', re.MULTILINE) + match = re.search(parent_search_pattern, content) + if match: + parent_name = match.group(0).split(' ')[1] + else: + parent_name = '' + del match image = Image(image_name, canonical_name, path, - parent_name=content.split(' ')[1].split('\n')[0], + parent_name=parent_name, logger=make_a_logger(self.conf, image_name)) if self.install_type == 'source': |
