Hooks
-
Is there any event for when a host successfully images that I can write a hook for?
-
Yes: ‘HOST_IMAGE_COMPLETE’
See my Pushbullet plugin for an example: https://github.com/FOGProject/fogproject/tree/dev-branch/packages/web/lib/plugins/pushbullet
Specifically this file for registering the hook: https://github.com/FOGProject/fogproject/blob/dev-branch/packages/web/lib/plugins/pushbullet/events/ImageComplete_PushBullet.event.php#L18 -
Awesome, you just made my fog/puppet stack workflow alot easier.
-
I forgot to specify that I’m currently running 1.2.0.
I’m looking at the HookManager class file and I don’t see ‘HOST_IMAGE_COMPLETE’ event.
Is it that your ImageComplete_PushBullet.event.php declares the event to be hooked?
Or is ‘HOST_IMAGE_COMPLETE’ defined only in 1.3 beta?
-
Event’s, as @Jbob has described, was only added in the current versions of FOG.
-
Thanks for the clarification Tom, any idea where I could drop an interpolated bash command anywhere after the imaging process?
need something like this
“puppet cert clean ${hostname}”
-
If the intent is to do this from the “client” before it reboots into windows, then you can use the postdownloadscripts.
-
No this is from the server, I was under the assumption that after the linux pxe image on the “client” was done running partclone that it would return some form of success, seeing that if the machine fails halfway through the task that when pxe booting again will try running the scheduled image task.
-
Looked a little more into postdownloadscripts, and I can send a network message to my server which makes for an okay hack at the moment for what I need to do, but if you have a solution for something that runs server side that would be desired.
-
service/Post_Stage3.php is called on the server side when a client finishes imaging.
-
@Jbob exactly what I was looking for thanks!