Add check for string type dport
the dport option could be a port number using a string instead of a array or int. This change ensures our loop is able to properly handle dport options written as list, string, or int. Change-Id: I13dbdb2043ad216d1c89801c974508dd9b958cdc Signed-off-by: Kevin Carter <kevin@cloudnull.com>
This commit is contained in:
parent
8ca1ca46a9
commit
2e7ec8ad2b
@ -22,11 +22,11 @@
|
||||
tripleo_firewall_rules:
|
||||
'003 accept ftp from all':
|
||||
proto: 'tcp'
|
||||
dport: 21
|
||||
dport: "21"
|
||||
'003 accept custom from all':
|
||||
proto: 'udp'
|
||||
dport:
|
||||
- 2121
|
||||
- "2121"
|
||||
- 2122
|
||||
- 2123
|
||||
- 2200-2210
|
||||
|
@ -22,13 +22,13 @@
|
||||
tripleo_firewall_rules:
|
||||
'003 accept ftp from all':
|
||||
proto: 'tcp'
|
||||
dport: 21
|
||||
dport: "21"
|
||||
extras:
|
||||
ensure: 'absent'
|
||||
'003 accept custom from all':
|
||||
proto: 'udp'
|
||||
dport:
|
||||
- 2121
|
||||
- "2121"
|
||||
- 2122
|
||||
- 2123
|
||||
- 2200-2210
|
||||
|
@ -60,7 +60,7 @@
|
||||
when:
|
||||
- (item['rule']['proto'] | default('tcp')) != 'ipv6'
|
||||
- item['rule']['source'] | default('127.0.0.1') | ipv4
|
||||
loop: "{{ (item['rule']['dport'] is iterable) | ternary(item['rule']['dport'], [item['rule']['dport']]) }}"
|
||||
loop: "{{ ((item['rule']['dport'] is iterable) and (item['rule']['dport'] is not string)) | ternary(item['rule']['dport'], [item['rule']['dport']]) }}"
|
||||
loop_control:
|
||||
loop_var: port
|
||||
notify:
|
||||
@ -83,7 +83,7 @@
|
||||
when:
|
||||
- (item['rule']['proto'] | default('tcp')) != 'ipv4'
|
||||
- item['rule']['source'] | default('::') | ipv6
|
||||
loop: "{{ (item['rule']['dport'] is iterable) | ternary(item['rule']['dport'], [item['rule']['dport']]) }}"
|
||||
loop: "{{ ((item['rule']['dport'] is iterable) and (item['rule']['dport'] is not string)) | ternary(item['rule']['dport'], [item['rule']['dport']]) }}"
|
||||
loop_control:
|
||||
loop_var: port
|
||||
notify:
|
||||
|
Loading…
Reference in New Issue
Block a user