Foreman hooks script incompatible issue due to the changes of "Fixes #16114"

Hello,

I use a foreman hooks script which controlled by the host parameters, but the script has not worked since updating foreman from 1.13 to 1.14.

When looking into the code, I found that it's due to "Fixes #16114" on 1.14.0.
JSON representation of the hook object passed in on stdin has not included parameters/all_parameters arrays.

[Add parameters to host API response when given include=parameters or all_parameters (#16114)]
<Feature #16114: Expose host parameters to GET /api/hosts - Foreman>

app/views/api/v2/hosts/show.json.rabl

5 -node do |host|
6 - { :parameters => partial("api/v2/parameters/base", :object => host.host_parameters.authorized) }
7 -end
8 -
9 -node do |host|
10 - { :all_parameters => partial("api/v2/parameters/base", :object => host.host_params_objects) }
11 -end

In addition to foreman hooks, host API such as "POST /api/hosts" and "PUT /api/hosts/:id" have not returned parameters/all_parameters arrays in JSON response since applying this patch.

I suggest to return to show.json.rabl back to the original. I think that the restoration of show.json.rabl does not affect the other API's JSON response such as "GET /api/hosts" or "GET /api/hosts/:id".

Does it have any problems or affect any APIs/Plugins?
If so, I will propose an alternative patch for foreman hooks to revive missing arrays.

Regards,
Akira Hirai

Hello,

I'm also missing the parameters arrays in the JSON generated by foreman
hook. Is it possible to update it to include them?

Thanks.

ยทยทยท On Monday, February 13, 2017 at 1:31:30 PM UTC+1, Hirai, Akira wrote: > > Hello, > > I use a foreman hooks script which controlled by the host parameters, but > the script has not worked since updating foreman from 1.13 to 1.14. > > When looking into the code, I found that it's due to "Fixes #16114" on > 1.14.0. > JSON representation of the hook object passed in on stdin has not included > parameters/all_parameters arrays. > > [Add parameters to host API response when given include=parameters or > all_parameters (#16114)] > > > app/views/api/v2/hosts/show.json.rabl > > 5 -node do |host| > 6 - { :parameters => partial("api/v2/parameters/base", :object => > host.host_parameters.authorized) } > 7 -end > 8 - > 9 -node do |host| > 10 - { :all_parameters => partial("api/v2/parameters/base", :object => > host.host_params_objects) } > 11 -end > > > In addition to foreman hooks, host API such as "POST /api/hosts" and "PUT > /api/hosts/:id" have not returned parameters/all_parameters arrays in JSON > response since applying this patch. > > I suggest to return to show.json.rabl back to the original. I think that > the restoration of show.json.rabl does not affect the other API's JSON > response such as "GET /api/hosts" or "GET /api/hosts/:id". > > Does it have any problems or affect any APIs/Plugins? > If so, I will propose an alternative patch for foreman hooks to revive > missing arrays. > > Regards, > Akira Hirai > >