|
|
@ -310,32 +310,6 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|
|
|
return cidr == rule['cidrlist']
|
|
|
|
return cidr == rule['cidrlist']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_network(self, key=None):
|
|
|
|
|
|
|
|
if self.network:
|
|
|
|
|
|
|
|
return self._get_by_key(key, self.network)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
network = self.module.params.get('network')
|
|
|
|
|
|
|
|
if not network:
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args = {}
|
|
|
|
|
|
|
|
args['account'] = self.get_account('name')
|
|
|
|
|
|
|
|
args['domainid'] = self.get_domain('id')
|
|
|
|
|
|
|
|
args['projectid'] = self.get_project('id')
|
|
|
|
|
|
|
|
args['zoneid'] = self.get_zone('id')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
networks = self.cs.listNetworks(**args)
|
|
|
|
|
|
|
|
if not networks:
|
|
|
|
|
|
|
|
self.module.fail_json(msg="No networks available")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for n in networks['network']:
|
|
|
|
|
|
|
|
if network in [ n['displaytext'], n['name'], n['id'] ]:
|
|
|
|
|
|
|
|
self.network = n
|
|
|
|
|
|
|
|
return self._get_by_key(key, n)
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
self.module.fail_json(msg="Network '%s' not found" % network)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_firewall_rule(self):
|
|
|
|
def create_firewall_rule(self):
|
|
|
|
firewall_rule = self.get_firewall_rule()
|
|
|
|
firewall_rule = self.get_firewall_rule()
|
|
|
|
if not firewall_rule:
|
|
|
|
if not firewall_rule:
|
|
|
|