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

switch to use get_name() instead of .name #267

Merged
merged 1 commit into from
Feb 5, 2024
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
6 changes: 3 additions & 3 deletions src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ def generate_dockerfile(extensions, args_dict, base_image):
dockerfile_str = ''
# Preamble snippets
for el in extensions:
dockerfile_str += '# Preamble from extension [%s]\n' % el.name
dockerfile_str += '# Preamble from extension [%s]\n' % el.get_name()
dockerfile_str += el.get_preamble(args_dict) + '\n'
dockerfile_str += '\nFROM %s\n' % base_image
# ROOT snippets
dockerfile_str += 'USER root\n'
for el in extensions:
dockerfile_str += '# Snippet from extension [%s]\n' % el.name
dockerfile_str += '# Snippet from extension [%s]\n' % el.get_name()
dockerfile_str += el.get_snippet(args_dict) + '\n'
# Set USER if user extension activated
if 'user' in args_dict and args_dict['user']:
Expand All @@ -443,7 +443,7 @@ def generate_dockerfile(extensions, args_dict, base_image):
dockerfile_str += f'USER {username}\n'
# USER snippets
for el in extensions:
dockerfile_str += '# User Snippet from extension [%s]\n' % el.name
dockerfile_str += '# User Snippet from extension [%s]\n' % el.get_name()
dockerfile_str += el.get_user_snippet(args_dict) + '\n'
return dockerfile_str

Expand Down
8 changes: 4 additions & 4 deletions test/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ def test_args_single(self):
"""Passing source path"""
arg = [[self._curr_path]]
expected = [['{}:{}'.format(self._curr_path, self._curr_path)]]
mock_cliargs = {Volume.name: arg}
mock_cliargs = {Volume.get_name(): arg}
self._test_equals_args(mock_cliargs, expected)

def test_args_twopaths(self):
"""Passing source path, dest path"""
arg = ["{}:{}".format(self._curr_path, self._virtual_path)]
mock_cliargs = {Volume.name: [arg]}
mock_cliargs = {Volume.get_name(): [arg]}
self._test_equals_args(mock_cliargs, arg)

def test_args_twopaths_opt(self):
"""Passing source path, dest path, and Docker's volume option"""
arg = ["{}:{}:ro".format(self._curr_path, self._virtual_path)]
mock_cliargs = {Volume.name: [arg]}
mock_cliargs = {Volume.get_name(): [arg]}
self._test_equals_args(mock_cliargs, arg)

def test_args_two_volumes(self):
"""Multiple volume points"""
arg_first = ["{}:{}:ro".format(self._curr_path, self._virtual_path)]
arg_second = ["/tmp:{}".format(os.path.join(self._virtual_path, "tmp"))]
args = [arg_first, arg_second]
mock_cliargs = {Volume.name: args}
mock_cliargs = {Volume.get_name(): args}
self._test_equals_args(mock_cliargs, args)
Loading