Skip to content
Snippets Groups Projects
Commit 7c038f8c authored by Michael Loipführer's avatar Michael Loipführer
Browse files

fix dry run for iptables

parent cab227b4
No related branches found
No related tags found
No related merge requests found
...@@ -129,9 +129,10 @@ def create_container(dry_run, config_file, name): ...@@ -129,9 +129,10 @@ def create_container(dry_run, config_file, name):
f.write(template.render(context)) f.write(template.render(context))
click.echo(f'Updating Iptable rules for port {context["ssh_port"]}') click.echo(f'Updating Iptable rules for port {context["ssh_port"]}')
ip_ranges = ['10.150.0.0/17', '141.84.69.0/24'] if not dry_run:
for ip_range in ip_ranges: ip_ranges = ['10.150.0.0/17', '141.84.69.0/24']
run(['iptables', '-A', 'INPUT', '-p', 'tcp', '-m', 'tcp', '--dport', context['ssh_port'], '-s', ip_range, '-j', 'ACCEPT']) for ip_range in ip_ranges:
run(['iptables', '-A', 'INPUT', '-p', 'tcp', '-m', 'tcp', '--dport', context['ssh_port'], '-s', ip_range, '-j', 'ACCEPT'])
click.echo('Starting container') click.echo('Starting container')
if not dry_run: if not dry_run:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment