Skip to content

Commit

Permalink
Only move pipeline.json if it exists, as part of #751.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Feb 8, 2019
1 parent 7c95bdd commit 4971f5c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kive/container/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,15 @@ def extract_archive(self, extraction_path):
for member in all_members
if not member.name.startswith('kive/pipeline')]
last_member = all_members[-1]
members.append(last_member)
if last_member.name.startswith('kive/pipeline'):
members.append(last_member)
else:
last_member = None
archive.extractall(extraction_path, members)
old_name = os.path.join(extraction_path, last_member.name)
new_name = os.path.join(extraction_path, 'kive', 'pipeline.json')
os.rename(old_name, new_name)
if last_member is not None:
old_name = os.path.join(extraction_path, last_member.name)
new_name = os.path.join(extraction_path, 'kive', 'pipeline.json')
os.rename(old_name, new_name)

@contextmanager
def open_content(self, mode='r'):
Expand Down

0 comments on commit 4971f5c

Please sign in to comment.