Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Commit

Permalink
Use safe_dump to generate yaml without tags
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnchaC committed Dec 13, 2016
1 parent 26c78af commit 9f02060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion onionbalance/settings.py
Expand Up @@ -328,7 +328,7 @@ def generate_config():
'name': '{}{}'.format(tag, i+1)} for
i, (address, _) in enumerate(instances)]
settings_data = {'services': [service_data]}
config_yaml = yaml.dump(settings_data, default_flow_style=False)
config_yaml = yaml.safe_dump(settings_data, default_flow_style=False)

config_file_path = os.path.join(master_dir, 'config.yaml')
with open(config_file_path, "w") as config_file:
Expand Down
3 changes: 3 additions & 0 deletions test/functional/test_onionbalance_config.py
Expand Up @@ -64,6 +64,9 @@ def check_basic_config_output(config_dir):
config_file = config_dir.join('master', 'config.yaml').read_text('utf-8')
assert all(address in config_file for address in instance_addresses)

# Test that all addresses are encoded as bytes and not unicode
assert "!!python/unicode" not in config_file

return True


Expand Down

0 comments on commit 9f02060

Please sign in to comment.