mirror of
https://github.com/jbowdre/phpIPAM-for-vRA8.git
synced 2024-11-21 14:32:19 +00:00
Allow for subnets without DNS servers defined in IPAM; increment to v1.0.1
This commit is contained in:
parent
1f71766392
commit
6581fde145
2 changed files with 7 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -23,7 +23,7 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||||
<properties>
|
<properties>
|
||||||
<provider.name>phpIPAM</provider.name>
|
<provider.name>phpIPAM</provider.name>
|
||||||
<provider.description>phpIPAM integration for vRA</provider.description>
|
<provider.description>phpIPAM integration for vRA</provider.description>
|
||||||
<provider.version>1.0</provider.version>
|
<provider.version>1.0.1</provider.version>
|
||||||
|
|
||||||
<provider.supportsAddressSpaces>false</provider.supportsAddressSpaces>
|
<provider.supportsAddressSpaces>false</provider.supportsAddressSpaces>
|
||||||
<provider.supportsUpdateRecord>true</provider.supportsUpdateRecord>
|
<provider.supportsUpdateRecord>true</provider.supportsUpdateRecord>
|
||||||
|
|
|
@ -75,7 +75,12 @@ def do_get_ip_ranges(self, auth_credentials, cert):
|
||||||
ipRange['startIPAddress'] = str(network[10])
|
ipRange['startIPAddress'] = str(network[10])
|
||||||
ipRange['endIPAddress'] = str(network[-6])
|
ipRange['endIPAddress'] = str(network[-6])
|
||||||
ipRange['subnetPrefixLength'] = str(subnet['mask'])
|
ipRange['subnetPrefixLength'] = str(subnet['mask'])
|
||||||
|
# return empty set if no nameservers are defined in IPAM
|
||||||
|
try:
|
||||||
ipRange['dnsServerAddresses'] = [server.strip() for server in str(subnet['nameservers']['namesrv1']).split(';')]
|
ipRange['dnsServerAddresses'] = [server.strip() for server in str(subnet['nameservers']['namesrv1']).split(';')]
|
||||||
|
except:
|
||||||
|
ipRange['dnsServerAddresses'] = []
|
||||||
|
# try to get the address marked as the gateway in IPAM
|
||||||
gw_req = requests.get(f"{subnet_uri}/{subnet['id']}/addresses/?filter_by=is_gateway&filter_value=1", headers=token, verify=cert)
|
gw_req = requests.get(f"{subnet_uri}/{subnet['id']}/addresses/?filter_by=is_gateway&filter_value=1", headers=token, verify=cert)
|
||||||
if gw_req.status_code == 200:
|
if gw_req.status_code == 200:
|
||||||
gateway = gw_req.json()['data'][0]['ip']
|
gateway = gw_req.json()['data'][0]['ip']
|
||||||
|
|
Loading…
Reference in a new issue