I've noticed things like this occasionally, especially before the v2 API
was the default but now its starting to cause issues.
I'm just starting to work on migrating from foreman 1.8 to the latest 1.10
RC2 and have some issue with the API changes…
-
Environments have changed. In foreman 1.8 the following API would return
details of the production environment…/api/environments/production/
In 1.10rc2 this now gives an error:
"message": "Environment not found by id 'production'"
Now the API call must have the environment id rather than the name. Its not
a massive problem but it also affects related APIs (eg
/api/environments/production/puppetclasses). Since the environment name is
unique I dont see why this should not work. Conversely, the name-based
query of the hosts API works fine (/api/hosts/myhost.fqdn/)
- This is the biggest problem I have come across so far. The structure of
the object returned by the foreman function (defined in
/usr/share/foreman-installer/modules/foreman/lib/puppet/parser/functions/foreman.rb)
has changed between versions. Example:
Query:
foreman({ item => 'environments'})
Object returned by foreman 1.8:
[{"environment"=>
{"id"=>2,
"name"=>"development",
"updated_at"=>"2015-10-28T14:09:25Z",
"created_at"=>"2015-10-28T14:09:25Z"}},
{"environment"=>
{"id"=>1,
"name"=>"production",
"updated_at"=>"2015-10-28T14:08:33Z",
"created_at"=>"2015-10-28T14:08:33Z"}}]
Object returned by foreman 1.10rc2:
{"sort"=>{"by"=>nil, "order"=>nil},
"subtotal"=>2,
"page"=>1,
"total"=>2,
"results"=>
[{"updated_at"=>"2015-11-16T15:53:38Z",
"created_at"=>"2015-11-16T15:53:38Z",
"id"=>2,
"name"=>"development"},
{"updated_at"=>"2015-11-16T15:34:07Z",
"created_at"=>"2015-11-16T15:34:07Z",
"id"=>1,
"name"=>"production"}],
"per_page"=>20,
"search"=>""}
The foreman function hasnt changed between versions, I guess its the data
being returned by the API. This change breaks any manifests using the data
returned by the foreman function.
Is this a bug or a "feature"?
Thanks
Jeff