Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #244 #245

Merged
merged 3 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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