Skip to content

Commit

Permalink
Merge pull request #1 from tdesvenain/master
Browse files Browse the repository at this point in the history
Fix when pyyaml has interpreted line as a dictionary
  • Loading branch information
sampwing committed Jan 27, 2015
2 parents f3999c6 + c33d131 commit c0abe43
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions fig/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,19 @@ def build_extra_hosts(extra_hosts_config):
if extra_hosts_config is None:
return None

if isinstance(extra_hosts_config, list):
return dict(r.split(':') for r in extra_hosts_config)
else:
return dict([extra_hosts_config.split(':')])
if isinstance(extra_hosts_config, basestring):
extra_hosts_config = [extra_hosts_config]

extra_hosts_dict = {}
for extra_hosts_line in extra_hosts_config:
if isinstance(extra_hosts_line, dict):
# already interpreted as a dict (depends on pyyaml version)
extra_hosts_dict.update(extra_hosts_line)
else:
# not already interpreted as a dict
extra_hosts_dict.update(extra_hosts_line.split(':'))

return extra_hosts_dict


def merge_environment(options):
Expand Down

0 comments on commit c0abe43

Please sign in to comment.