Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1337200

Summary: Foreman hooks does not contain all the JSON data
Product: Red Hat Satellite Reporter: Lukas Zapletal <lzap>
Component: Hooks and WebhooksAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, bkearney, cwelton, dmoessne, ehelms, ohadlevy, tomckay
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: https://github.com/theforeman/foreman_hooks/pull/36
Whiteboard:
Fixed In Version: rubygem-foreman_hooks-0.3.11-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:22:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Zapletal 2016-05-18 13:31:11 UTC
When hooking host/create or after_create and creating it via UI with Katello
plugin enabled, create RABL does reference facet code references something from
Katello leading to error:

Cannot find rabl template 'katello/api/v2/content_facet/base_with_root' within
registered (["app/views", "/usr/share/foreman/app/views"]) view paths!
This is because Katello extend the base RABL with some extra things.

https://github.com/theforeman/foreman_hooks/pull/36

Triage notes: Proposal for GA candidate as there are many customers implementing workarounds using hooks. This prevents from foreman hooks usage.

Comment 4 Lukas Zapletal 2016-06-14 15:24:54 UTC
QA notes: Install a test hook:

cat config/hooks/host/managed/create/00_test.sh 
#!/bin/bash
echo " *** got hook $* ***" >> /tmp/hook.log
cat >> /tmp/hook.log
exit 0

Create a new host and verify the log file contains MAC address. Previously, it was missing from the JSON output.

Tests together with bug https://bugzilla.redhat.com/show_bug.cgi?id=1334707 - both patches are required to be present.

Comment 5 Bryan Kearney 2016-06-23 19:48:50 UTC
VERIFIED
Version Verified On:
Snap 17
satellite-6.2.0-17.0.el6sat.noarch

Steps to verify
* Install Satellite on RHEL6
* Create hook file in /usr/share/foreman/config/hooks as described above
* Make the file executable
* Restart foreman, see that the file is discovered.
* Create a host
* Check the log file, mac exists (data below)
* Check production.logs, no errors.

[root@sat-test-rhel6 config]# cat /tmp/hook.log 
 *** got hook create test7.example.com ***
{"host":{"ip":"199.99.99.7","environment_id":null,"environment_name":null,"last_report":null,"mac":"3d:f2:c9:a6:b3:b7","realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":1,"domain_name":"example.com","architecture_id":1,"architecture_name":"x86_64","operatingsystem_id":2,"operatingsystem_name":"RHEL Server 6.8","subnet_id":1,"subnet_name":"test","sp_subnet_id":null,"ptable_id":61,"ptable_name":"Kickstart default","medium_id":1,"medium_name":"CentOS mirror","build":true,"comment":"","disk":"","installed_at":null,"model_id":null,"hostgroup_id":null,"owner_id":3,"owner_type":"User","enabled":true,"puppet_ca_proxy_id":null,"managed":true,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"compute_resource_name":null,"compute_profile_id":null,"compute_profile_name":null,"capabilities":["build"],"provision_method":"build","puppet_proxy_id":null,"certname":"test7.example.com","image_id":null,"image_name":null,"created_at":null,"updated_at":null,"last_compile":null,"global_status":0,"global_status_label":"OK","organization_id":1,"organization_name":"Default Organization","location_id":2,"location_name":"Default Location","puppet_status":0,"model_name":null,"build_status":1,"build_status_label":"Pending installation","name":"test7.example.com","id":null,"hostgroup_name":null,"hostgroup_title":null,"parameters":[],"interfaces":[{"id":null,"name":"test7.example.com","ip":"199.99.99.7","mac":"3d:f2:c9:a6:b3:b7","identifier":"","primary":true,"provision":true,"type":"interface"}],"puppetclasses":[],"config_groups":[],"all_parameters":[],"all_puppetclasses":[],"permissions":{"view_hosts":true,"create_hosts":true,"edit_hosts":true,"destroy_hosts":true,"build_hosts":true,"power_hosts":true,"console_hosts":true,"ipmi_boot":true,"puppetrun_hosts":true,"view_discovered_hosts":true,"submit_discovered_hosts":true,"auto_provision_discovered_hosts":true,"provision_discovered_hosts":true,"edit_discovered_hosts":true,"destroy_discovered_hosts":true}}}

Comment 6 Bryan Kearney 2016-06-24 14:57:18 UTC
*** Bug 1204358 has been marked as a duplicate of this bug. ***

Comment 7 Bryan Kearney 2016-07-27 11:22:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501