I recently upgraded our Foreman installation from 1.7 to 1.9. We have some
code that relies on the v1 API, which after the upgrade to 1.9, stopped
working. Looking at the release notes, I can see the default version of
the API changed from v1 to v2. I attempted to explicitly set the version
in the HTTP header (version=1), but now I get a duplicate record conflict
when trying to update an existing record with a PUT.
2015-12-14 09:03:45,051 - lookup - CRITICAL - Didn't get a 200 OK from
Foreman: {"host":{"id":48328,"errors":{"interfaces.ip":["has already been
taken"]},"full_messages":["Ip has already been taken"]}}
The call itself looks like this:
r = SESSION.put('%s://%s/api/%s/%s' % (PROTOCOL, SERVER, plural, self['id'
]), data=json.dumps(self._arguments))
With the server URI:
https://myforemanserver/api/hosts/48328
Does something look wrong here? It looks to me like the API is trying to
create a new record, even though I'm specifying an update using PUT.
It looks like this is related to #12486,
http://projects/theforeman.org/issues/12486
A number of our host records have duplicate IP addresses defined (for
interfaces eth0 and bond0). It looks like I'm unable to remove the extra
interface, and the API call fails as a result.
ยทยทยท
On Monday, December 14, 2015 at 9:23:01 AM UTC-8, Kyle Flavin wrote:
>
> I recently upgraded our Foreman installation from 1.7 to 1.9. We have
> some code that relies on the v1 API, which after the upgrade to 1.9,
> stopped working. Looking at the release notes, I can see the default
> version of the API changed from v1 to v2. I attempted to explicitly set
> the version in the HTTP header (version=1), but now I get a duplicate
> record conflict when trying to update an existing record with a PUT.
>
> 2015-12-14 09:03:45,051 - lookup - CRITICAL - Didn't get a 200 OK from
> Foreman: {"host":{"id":48328,"errors":{"interfaces.ip":["has already been
> taken"]},"full_messages":["Ip has already been taken"]}}
>
> The call itself looks like this:
>
> r = SESSION.put('%s://%s/api/%s/%s' % (PROTOCOL, SERVER, plural, self['id'
> ]), data=json.dumps(self._arguments))
>
>
> With the server URI:
>
> https://myforemanserver/api/hosts/48328
>
>
> Does something look wrong here? It looks to me like the API is trying to
> create a new record, even though I'm specifying an update using PUT.
>
>
>