Skip to content

Commit

Permalink
Merge pull request #245 from scanon/issue244
Browse files Browse the repository at this point in the history
Fix for Issue #244
  • Loading branch information
scanon authored Mar 6, 2019
2 parents 4497d28 + 2b22f9a commit eaf113c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions imagegw/shifter_imagegw/dockerv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ def filter_layer(layer_members, to_remove):
# get directory of tar contents
members = tfp.getmembers()

# Normalize paths
for x in members:
if x.name[0:2] == './':
x.name = x.name[2:]
# remove all illegal files
members = filter_layer(members, 'dev/')
members = filter_layer(members, '/')
Expand Down
12 changes: 12 additions & 0 deletions imagegw/test/dockerv2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ def test_chgtype(self):
bfile = os.path.join(resp['expandedpath'], 'build/test2')
assert os.path.exists(bfile)

def test_import(self):
cache = tempfile.mkdtemp()
expand = tempfile.mkdtemp()
self.cleanpaths.append(cache)
self.cleanpaths.append(expand)

resp = dockerv2.pull_image(self.options, 'scanon/importtest', 'latest',
cachedir=cache, expanddir=expand)
assert os.path.exists(resp['expandedpath'])
bfile = os.path.join(resp['expandedpath'], 'home')
self.assertTrue(os.path.islink(bfile))

def test_need_proxy(self):
"""
Test if proxy is needed
Expand Down

0 comments on commit eaf113c

Please sign in to comment.