{% macro setup_py(values) -%} from deluge.config import Config import os import shutil if not os.path.exists('/config/core.conf'): print('Copying default config') shutil.copyfile('/defaults/core.conf', '/config/core.conf') print('Loading config') config = Config('/config/core.conf') print('Setting listen ports to [{{ values.network.torrent_port.port_number }}]') config['listen_ports'] = [{{ values.network.torrent_port.port_number }}, {{ values.network.torrent_port.port_number }}] print('Saving config') Config.save(config) print('Done') {%- endmacro %}