mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
cloudstack: use get_or_fallback() from cloudstack utils
This commit is contained in:
parent
743ed1cd82
commit
1f25377ce9
6 changed files with 14 additions and 59 deletions
|
@ -215,18 +215,12 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|||
self.firewall_rule = None
|
||||
|
||||
|
||||
def get_end_port(self):
|
||||
if self.module.params.get('end_port'):
|
||||
return self.module.params.get('end_port')
|
||||
return self.module.params.get('start_port')
|
||||
|
||||
|
||||
def get_firewall_rule(self):
|
||||
if not self.firewall_rule:
|
||||
cidr = self.module.params.get('cidr')
|
||||
protocol = self.module.params.get('protocol')
|
||||
start_port = self.module.params.get('start_port')
|
||||
end_port = self.get_end_port()
|
||||
end_port = self.get_or_fallback('end_port', 'start_port')
|
||||
icmp_code = self.module.params.get('icmp_code')
|
||||
icmp_type = self.module.params.get('icmp_type')
|
||||
fw_type = self.module.params.get('type')
|
||||
|
@ -327,7 +321,7 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|||
args['cidrlist'] = self.module.params.get('cidr')
|
||||
args['protocol'] = self.module.params.get('protocol')
|
||||
args['startport'] = self.module.params.get('start_port')
|
||||
args['endport'] = self.get_end_port()
|
||||
args['endport'] = self.get_or_fallback('end_port', 'start_port')
|
||||
args['icmptype'] = self.module.params.get('icmp_type')
|
||||
args['icmpcode'] = self.module.params.get('icmp_code')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue