UUID not passed to the Foreman destroy hooks in Foreman version 2.2.1

Problem:
Foreman does not pass the VM uuid to the Foreman destroy hooks in Foreman version 2.2.1. Foreman does pass the uuid to the Foreman destroy hooks in Foreman version 2.1.4.

Our Foreman hooks save the Foreman host object passed to the hooks on stdin to a file. The hooks also run the command “hammer host info” to save the host object to a file. Note the ‘“uuid”: null’ line in Foreman version 2.2.1 destroy hook below. The hammer command in the destroy hook shows the uuid. The destroy hooks expect the uuid to be set.

Foreman 2.1.4
grep -i uuid vm6*
vm6_create.json:        "uuid": "0b81184f-5037-4cb6-b522-e43006e96a85",
vm6_destroy_hammer.json:  "UUID": "0b81184f-5037-4cb6-b522-e43006e96a85",
vm6_destroy.json:        "uuid": "0b81184f-5037-4cb6-b522-e43006e96a85",
vm6_update_hammer.json:  "UUID": "0b81184f-5037-4cb6-b522-e43006e96a85",
vm6_update.json:        "uuid": "0b81184f-5037-4cb6-b522-e43006e96a85",

Foreman 2.2.1
grep -i uuid vm6*
vm6_create.json:        "uuid": "33d5f5e3-6792-4972-bce0-e27fc24c6069",
vm6_destroy_hammer.json:  "UUID": "33d5f5e3-6792-4972-bce0-e27fc24c6069",
vm6_destroy.json:        "uuid": null,
vm6_update_hammer.json:  "UUID": "33d5f5e3-6792-4972-bce0-e27fc24c6069",
vm6_update.json:        "uuid": "33d5f5e3-6792-4972-bce0-e27fc24c6069",

Expected outcome:

Foreman and Proxy versions:
Foreman 2.2.1
Foreman and Proxy plugin versions:

Distribution and version:
CentOS 7
Other relevant data:

I found that when the “Destroy associated VM on host delete” option is set to “No” then the uuid is not passed by Foreman to the destroy hook. When the value is set to “Yes” then the uuid is passed to the destroy hook.

Keith