theforeman / foreman_hooks

Run custom hook scripts on Foreman events
http://m0dlx.com/blog/Extending_Foreman_quickly_with_hook_scripts.html
GNU General Public License v3.0
56 stars 50 forks source link

Empty values/No facts as json input for after_create event after discovery #49

Closed lohitv9 closed 7 years ago

lohitv9 commented 7 years ago

Using tfm-rubygem-foreman_hooks-0.3.14-1.fm1_15.el7.noarch foreman-proxy-1.15.3-1.el7.noarch foreman-1.15.3-1.el7.noarch tfm-rubygem-foreman_discovery-9.1.1-1.fm1_15.el7.noarch

I dont see facts in input json after foreman discovers a VM/baremetal.

This is the workflow that i am trying with hooks and foreman discovery

VM/baremetal gets discovered -> JSON input to hooks -> Hooks use the facts from JSON input to add more facts from CMDB -> Facts get uploaded to foreman.

I have created the following hooks:

/usr/share/foreman/config/hooks/host/discovered/after_create/10-logger.py

ls /usr/share/foreman-community/hooks/ functions.py functions.pyc init.py

The scripts just get the input json and output the json to temp directory, to help me understand the structure. However - I dont see facts or any other useful information during input json.

{ "id": 22, "name": "mac00163e5426c9", "last_compile": null, "last_report": null, "updated_at": "2017-08-18T20:13:44.058Z", "created_at": "2017-08-18T20:13:44.058Z", "root_pass": null, "architecture_id": null, "operatingsystem_id": null, "environment_id": null, "ptable_id": null, "medium_id": null, "build": false, "comment": null, "disk": null, "installed_at": null, "model_id": null, "hostgroup_id": null, "owner_id": null, "owner_type": null, "enabled": true, "puppet_ca_proxy_id": null, "managed": false, "use_image": null, "image_file": null, "uuid": null, "compute_resource_id": null, "puppet_proxy_id": null, "certname": null, "image_id": null, "organization_id": null, "location_id": null, "otp": null, "realm_id": null, "compute_profile_id": null, "provision_method": null, "grub_pass": "", "global_status": 0, "lookup_value_matcher": null, "pxe_loader": null, "discovery_rule_id": null }