Closed JonasKs closed 4 years ago
@JonasKs As this was an auto generated client from the NIOS schema. There was no testing done on this. Hence this might have got missed. Will surely look into this.
Any status?
Had been occupied with other prioritized tasks. Will look into it ASAP.
@JonasKs
It does a get object request to see if the object already exists and in this case when we do a Get the appended search fields were
_search_for_update_fields = ['comment', 'network_view', 'network']
in 0.5.0 and hence the get request was making queries in this form:
GET /wapi/v2.7/network?comment=test+network&network=192.168.11.0%2F24
Wherein the comment would have to be updated but unfortunately even that goes into the search parameter. Hence we get a NONE response and the hence update fails. Removing the "comment" from _search_update_fields works fine on my local setup. But im not sure for how many objects i have to do that? May be i shall try a better method to implement this Update_if_exists. Will raise a PR Today/Tomorrow with a fix.
I haven't really used the 0.5.0 much(because of this), nor looked closely at the code, so I'm not sure what's the best solution to be honest. _search_update_fields
sounds like the correct thing to fix, if that's it's use.
Fixed in #267 and seems to be working fine. Please reopen if you feel the issue hasn't been resolved
@AvRajath Hi, I'm getting something similar with version 0.5.0. I try to update a host with a new IP so I do:
new_ip = objects.IP.create(ip="10.10.0.11", mac="88:88:88:88:88:55") # the ip and mac here are new
objects.HostRecord.create(conn, name="host2.test_zone.local", view="default", ip=new_ip, update_if_exists=True) # the name of the host is the existing host I want to update
I receive the error:
InfobloxCannotCreateObject: Cannot create 'record:host' object(s): b'{ "Error": "AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:The record \'host2.test_zone.local\' already exists.)", \n "code": "Client.Ibap.Data.Conflict", \n "text": "The record \'host2.test_zone.local\' already exists."\n}' [code 400]
Is this a real error or am I using it in the wrong way?
Hi,
Update if exists no longer work in version 0.5.0.
Results in an exception:
Downgrading to 0.4.25 works. I'm not able to look into this today, and I assume this is a core-thing with how you've generated your code compared to before.
Tagging @AvRajath since it's his PR.