mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -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
|
@ -221,18 +221,12 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
|||
and cidr == rule['cidr']
|
||||
|
||||
|
||||
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_rule(self, rules):
|
||||
user_security_group_name = self.module.params.get('user_security_group')
|
||||
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')
|
||||
|
||||
|
@ -290,7 +284,7 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
|||
|
||||
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')
|
||||
args['projectid'] = self.get_project('id')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue