mirror of
https://github.com/jbowdre/phpIPAM-for-vRA8.git
synced 2024-11-21 14:32:19 +00:00
Re-add 'owner' tag on phpIPAM reservation note inside 'try' block to work around bug in vRA 8.6
This commit is contained in:
parent
21ed9d7c66
commit
493452fdbf
1 changed files with 6 additions and 1 deletions
|
@ -145,9 +145,14 @@ def allocate_in_range(range_id, resource, allocation, context, endpoint, bundle)
|
||||||
uri = bundle['uri']
|
uri = bundle['uri']
|
||||||
token = bundle['token']
|
token = bundle['token']
|
||||||
cert = bundle['cert']
|
cert = bundle['cert']
|
||||||
|
# Attempt to grab 'owner' to work around bug in vRA 8.6 (fixed in 8.6.1)
|
||||||
|
try:
|
||||||
|
owner_string = f" for {resource['owner']} "
|
||||||
|
except:
|
||||||
|
owner_string = " "
|
||||||
payload = {
|
payload = {
|
||||||
'hostname': vmName,
|
'hostname': vmName,
|
||||||
'description': f'Reserved by vRA at {datetime.now()}'
|
'description': f'Reserved by vRA{owner_string}at {datetime.now()}'
|
||||||
}
|
}
|
||||||
allocate_uri = f'{uri}/addresses/first_free/{str(range_id)}/'
|
allocate_uri = f'{uri}/addresses/first_free/{str(range_id)}/'
|
||||||
allocate_req = requests.post(allocate_uri, data=payload, headers=token, verify=cert)
|
allocate_req = requests.post(allocate_uri, data=payload, headers=token, verify=cert)
|
||||||
|
|
Loading…
Reference in a new issue