Skip to content

Commit

Permalink
switch to use get_name() instead of .name
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Feb 5, 2024
1 parent 4401ae6 commit 9bedb6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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)

0 comments on commit 9bedb6a

Please sign in to comment.