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 #3281: Unexpected result when using build args with default values #3449

Merged
merged 3 commits into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion compose/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ def microseconds_from_time_nano(time_nano):


def build_string_dict(source_dict):
return dict((k, str(v)) for k, v in source_dict.items())
return dict((k, str(v if v else '')) for k, v in source_dict.items())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only problem with this is it'll result in the empty string for the integer 0, which probably isn't what the user expects. v if v is not None else '' is probably better. (Would be good to add an arg with a value of 0 to the test, too.)

2 changes: 1 addition & 1 deletion tests/unit/config/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def test_build_args_allow_empty_properties(self):
).services[0]
assert 'args' in service['build']
assert 'foo' in service['build']['args']
assert service['build']['args']['foo'] == 'None'
assert service['build']['args']['foo'] == ''

def test_load_with_multiple_files_mismatched_networks_format(self):
base_file = config.ConfigFile(
Expand Down