Problem: When running a deployment from a discovered host using the foreman_hook scripts i receive the below error in the production.local;
ForemanHooks::Error: Hook failure running `/usr/share/foreman/config/hooks/host/managed/after_build/02-dump-hook-variables.sh after_build rhspesxoc01.domain.com`:
Further error information appears in the after_build.log file that gets created.
Script is simple;
> #/bin/bash
>
> . $(dirname $0)/hook_functions.sh
>
> # event name (create, before_destroy etc.)
> # orchestration hooks must obey this to support rollbacks (create/update/destroy)
> event=${HOOK_EVENT}
>
> # to_s representation of the object, e.g. host's fqdn
> object=${HOOK_OBJECT}
>
> exec >> /tmp/${event}.log
> exec 2>&1
>
> system_name=$(hook_data host.host.name)
> system_mac=$(hook_data host.host.mac)
> system_pxe_loader=$(hook_data host.host.pxe_loader)
> system_operatingsystem_name=$(hook_data host.host.operatingsystem_name)
>
> echo "$(date): received ${event} on ${object}"
> echo "${system_name} ${system_mac} ${system_operatingsystem_name} ${system_pxe_loader}"
>
> echo "system mac: ${system_mac//:/-}"
> echo "system_name: ${system_name}"
> echo "system_pxe_loader: ${system_pxe_loader}"
> echo "system_operatingsystem_name: ${system_operatingsystem_name}"
Expected outcome: Log file is written with the above details.
Foreman and Proxy versions:
Foreman 1.19
foreman_tasks 0.13.2
foreman_ansible 2.2.6
foreman_discovery 13.0.1
foreman_hooks 0.3.14
foreman_remote_execution 1.5.5
Other relevant data:
> /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:135:in `rescue in <top (required)>': undefined method `status' for n
> from /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:99:in `<top (required)>'
> from /usr/local/bin/jgrep:23:in `load'
> from /usr/local/bin/jgrep:23:in `<main>'
> /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:135:in `rescue in <top (required)>': undefined method `status' for n
> from /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:99:in `<top (required)>'
> from /usr/local/bin/jgrep:23:in `load'
> from /usr/local/bin/jgrep:23:in `<main>'
> /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:135:in `rescue in <top (required)>': undefined method `status' for n
> from /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:99:in `<top (required)>'
> from /usr/local/bin/jgrep:23:in `load'
> from /usr/local/bin/jgrep:23:in `<main>'
> /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:135:in `rescue in <top (required)>': undefined method `status' for n
> from /var/lib/gems/2.3.0/gems/jgrep-1.5.0/bin/jgrep:99:in `<top (required)>'
> from /usr/local/bin/jgrep:23:in `load'
> from /usr/local/bin/jgrep:23:in `<main>'
> Sat Sep 15 18:31:15 AWST 2018: received after_build on rhspesxoc01.domain.com