mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
cloudstack: use get_or_fallback() from cloudstack utils
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user