Project

General

Profile

Actions

Bug #17455

open

Hooks are being triggered at every start of apache or foreman-rake

Added by Ivan Necas over 8 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1397432
Description of problem:
RemoteExecutionFeature bugs are being triggered each time when the apache is started or when any foreman-rake command is being executed.

Version-Release number of selected component (if applicable):
6.2.x

How reproducible:
create "remote_execution_feature" folder in "/usr/share/foreman/config/hooks" and then create folder(s) named by the event which is related to operation save i. e.

after_commit
after_create

(see foreman-rake hooks:events[remote_execution_feature] for complete list)

and then create a script in the event folder. - ex:
~~~
$: cat 00-update-log.sh
#!/bin/sh

LOG=/var/log/foreman/production.log
PREFIX="HOOK-EXEC:"

echo "$PREFIX Hook execution detected \"$0\", params $#: " >> $LOG

CNT=0
[ "$#" != "0" ] && while (( "$#" )); do
echo "$PREFIX $CNT: $1" >> $LOG
CNT=$(($CNT + 1))
shift
done

echo "$PREFIX Hook stdin data: " >> $LOG
echo -n "$PREFIX " >> $LOG
cat >> $LOG
echo "" >> $LOG
echo "$PREFIX End of execution ($0)" >> $LOG
~~~

Actual results:
Script will be executed every time the foreman-rake command will be executed or during the start of apache (Passenger)

Expected results:
Script will be executed only if a new feature will be introduced or updated.

Note: it's probably caused by calling update_attributes every time we initiate an environment https://github.com/theforeman/foreman_remote_execution/blob/master/app/models/remote_execution_feature.rb#L28


Related issues 1 (0 open1 closed)

Related to Foreman Remote Execution - Bug #17456: Hooks are being triggered at every start of apache or foreman-rakeClosedMarcel Gazdík11/23/2016Actions
Actions

Also available in: Atom PDF