I’m currently using foreman hooks to react to a postupdate
event.
My hooks is pretty simple, just send a Kafka message containing the host info.
#!/usr/bin/env ruby
require 'kafka'
kafka = Kafka.new([<kafka-broker>])
host_info = $stdin.read
hook_event = ARGV[0]
kafka.deliver_message(host_info, key: hook_event, topic: 'postupdate_hook_topic')
Using the API, I’m sending 3 requests back to back.
1st request: Update a host parameter
2nd request: Update the host details (OS, Image, ptable, etc.)
3rd request: Update a host parameter
However, I only get one message to my Kafka broker, which happens after the 1st request. Even though the second and third requests are successful (which I can confirm by using either the GUI or the response of the API), the postupdate
hook is not activated.
It is my understanding that the postupdate hook gets activated EVERY time a host gets updated, so I’m not sure why this is happening?
Am I understanding hooks wrong? Any help would be appreciated!