Running 1.15 with foreman_hooks, and the json output to my hooks is
different between a 'create' and 'destroy' event. In the 'destroy' event I
am missing host parameters from the json output, but I can't find the
reason for this in the code.
Anybody here know why this is?
(I want to force users to add a host parameter containing a reference to
our ticketing system before deleting a host, but since the host parameters
are not included in the json output I cant validate that the parameter is
set correctly. )
Thanks,
Adam
They have probably been deleted at the point "destroy" is called.
Internally in Foreman this uses the "after_destroy" event.
You could try using the "before_destroy" event instead.
···
On 23/05/17 14:35, AdamW wrote:
> Running 1.15 with foreman_hooks, and the json output to my hooks is
> different between a 'create' and 'destroy' event. In the 'destroy' event
> I am missing host parameters from the json output, but I can't find the
> reason for this in the code.
>
> Anybody here know why this is?
–
Dominic Cleal
dominic@cleal.org
> Running 1.15 with foreman_hooks, and the json output to my hooks is
> different between a 'create' and 'destroy' event. In the 'destroy' event I
> am missing host parameters from the json output, but I can't find the
> reason for this in the code.
>
> Anybody here know why this is?
>
>
I also see a change in JSON structure on update events as well.
In 1.14.1 it was something like this:
{
"host": {
"ip": "10.153.84.14",
"ip6": "",
"environment_id": 1,
"environment_name": "production",
"last_report": "2017-05-31 12:46:15 -0700",
"mac": "52:54:00:f7:41:45",
"realm_id": null,
"realm_name": null,
<snip>
But in 1.15.0 and even 1.14.3 it is like this:
{
"host": {
"host": {
"ip": "10.109.236.95",
"ip6": "",
"environment_id": 2,
"environment_name": "common",
"last_report": "2017-05-31 12:23:46 -0700",
"mac": "52:54:00:c7:da:da",
"realm_id": null,
"realm_name": null,
<snip>
Is this by design and going to be a format going forward? I checked the
release notes and did not find anything about that, but maybe it was not
obviously-named change.
It would be nice to advertise the change in JSON structures to allow people
to update their hooks, etc.
good point! I tried using the 'before_destroy' event but the 'parameters'
array was still empty. I get other output though, such as
'all_puppetclasses' and 'all_parameters'.
···
On Tue, May 23, 2017 at 3:38 PM, Dominic Cleal wrote:
On 23/05/17 14:35, AdamW wrote:
Running 1.15 with foreman_hooks, and the json output to my hooks is
different between a ‘create’ and ‘destroy’ event. In the ‘destroy’ event
I am missing host parameters from the json output, but I can’t find the
reason for this in the code.
Anybody here know why this is?
They have probably been deleted at the point “destroy” is called.
Internally in Foreman this uses the “after_destroy” event.
You could try using the “before_destroy” event instead.
–
Dominic Cleal
dominic@cleal.org
–
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
> But in 1.15.0 and even 1.14.3 it is like this:
>
> {
> "host": {
> "host": {
> "ip": "10.109.236.95",
> "ip6": "",
> "environment_id": 2,
> "environment_name": "common",
> "last_report": "2017-05-31 12:23:46 -0700",
> "mac": "52:54:00:c7:da:da",
> "realm_id": null,
> "realm_name": null,
> <snip>
>
I can't replicate this on 1.14.3 anymore, I think I may have mixed up my
data and it appears that only 1.15.0 is affected.
as a workaround I use the 'comment' attribute of the host object for my
purposes instead, which is included in the json. But it would be
interesting to know why the json output is missing data, even when using
the 'before_destroy' hook.
···
On Tue, May 23, 2017 at 3:48 PM, Adam Winberg wrote:
good point! I tried using the ‘before_destroy’ event but the ‘parameters’
array was still empty. I get other output though, such as
’all_puppetclasses’ and ‘all_parameters’.
On Tue, May 23, 2017 at 3:38 PM, Dominic Cleal dominic@cleal.org wrote:
On 23/05/17 14:35, AdamW wrote:
Running 1.15 with foreman_hooks, and the json output to my hooks is
different between a ‘create’ and ‘destroy’ event. In the ‘destroy’ event
I am missing host parameters from the json output, but I can’t find the
reason for this in the code.
Anybody here know why this is?
They have probably been deleted at the point “destroy” is called.
Internally in Foreman this uses the “after_destroy” event.
You could try using the “before_destroy” event instead.
–
Dominic Cleal
dominic@cleal.org
–
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
in 1.14.3 I also see that after_commit event JSON has changed from:
jq '.' mace41d2d1d6c30-after_commit-20170605-14-38-18-1496698698.json | head
{
"discovered_host": {
"facts_hash": {
"architecture": "amd64",
"augeasversion": "1.2.0",
"discovery_version": "3.0.5",
to:
jq '.' mace41d2d1d6c30-after_commit-20170605-14-38-18-1496698698.json | head
{
"discovered_host": {
"host": {
"facts_hash": {
"architecture": "amd64",
"augeasversion": "1.2.0",
"discovery_version": "3.0.5",
So, my previous question still stands - is this a permanent change going
forward or some kind of a bug?