Hook before_provision not being triggered

i cant get this hook triggered: “host/managed/before_provision”.
My end goal is to know when the OS has been installed completely, any other suggestions of hooks that would also work are welcomed.

Expected outcome:
hook is triggered

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Other relevant data:

  • have set foreman in debug log
  • i see that the hook is recognized:
    2018-04-19T02:33:14 [app] [D] Found hook to Host::Managed#before_provision, filename 50_callback_provisioner.sh
    2018-04-19T02:33:14 [app] [D] Found hook to Host::Managed#before_provision, filename scripty.sh
    2018-04-19T02:33:14 [app] [I] Finished discovering 2 hooks for Host::Managed#before_provision
    2018-04-19T02:33:21 [app] [D] Created hook method before_provision on Host::Managed
  • however when the machine issues the http://XXXXX/unattended/built wget call (as per documentation) the hook never gets triggered.

It’s little bit weird behavior, but here it is:

  • host/managed/after_build triggers when a host is put into build mode (does not trigger upon new host creation, even when build flag is set)
  • host/managed/before_provision triggers when a host completes the OS install

I think this will work even with quite old 1.12 version.

Hi Izap,

Thank you for the reply, i was aware of how it “Should” work (as its on the manual). What i was reporting here is that the functionality is not working for me.

When the http://XXXXX/unattended/built wget call gets issued the hook is NOT triggered. So something is not working.

Is the host really getting out of the build mode? We’ve seen some bugs or misconfigurations when hosts stayed in build mode forever.

Anyway, 1.12 is quite old version and I can’t tell if there was a bug or something, try to search git logs.

Also check SELinux, that can prevent execution. Also permissions are often an issue, we’ve seen hooks silently fail to exec in these cases in the past.