bundles: code style improvements
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-02-12 20:37:36 +01:00
parent 2af911c29f
commit f52df58517
Signed by: kunsi
GPG key ID: 12E3D2136B818350
24 changed files with 80 additions and 95 deletions

View file

@ -147,21 +147,21 @@ def monitoring(metadata):
)
def iptables(metadata):
interfaces = metadata.get('nginx/restrict-to-interfaces', set())
iptables = []
rules = []
if len(interfaces):
if interfaces:
for iface in sorted(interfaces):
iptables.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 80 -j ACCEPT')
iptables.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 443 -j ACCEPT')
rules.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 80 -j ACCEPT')
rules.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 443 -j ACCEPT')
else:
iptables.append('iptables_both -A INPUT -p tcp --dport 80 -j ACCEPT')
iptables.append('iptables_both -A INPUT -p tcp --dport 443 -j ACCEPT')
rules.append('iptables_both -A INPUT -p tcp --dport 80 -j ACCEPT')
rules.append('iptables_both -A INPUT -p tcp --dport 443 -j ACCEPT')
return {
'iptables': {
'bundle_rules': {
'nginx': iptables,
'nginx': rules,
},
},
}