Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2247641

Summary: Failed to run hook 'emit_event_running' for action 'x'
Product: Red Hat Satellite Reporter: Peter Ondrejka <pondrejk>
Component: Hooks and WebhooksAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.14.0Keywords: Regression
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-02 14:42:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
production log excerpt none

Description Peter Ondrejka 2023-11-02 14:14:40 UTC
Created attachment 1996733 [details]
production log excerpt

Description of problem:
Webhooks are not triggered, tested with several types of actions, the trigger fails as follows (production_log):

2023-11-02T09:55:52 [I|app|264129ed] ForemanWebhooks::EventSubscriber: actions.remote_execution.run_hosts_job_running.event.foreman event received
2023-11-02T09:55:52 [I|app|264129ed]   Rendered /usr/share/gems/gems/foreman_remote_execution-10.0.7/app/views/api/v2/job_invocations/create.json.rabl (Duration: 23.8ms | Allocations: 15503)
2023-11-02T09:55:52 [I|app|264129ed] Completed 201 Created in 318ms (Views: 30.5ms | ActiveRecord: 83.8ms | Allocations: 118377)
2023-11-02T09:55:52 [E|dyn|264129ed] Failed to run hook 'emit_event_running' for action 'Actions::RemoteExecution::RunHostsJob'
2023-11-02T09:55:52 [E|dyn|264129ed] undefined method '#id' for Actions::RemoteExecution::RunHostsJob::Jail (Actions::RemoteExecution::RunHostsJob) (Safemode::NoMethodError)

(full excerpt will follow in attachment)

Version-Release number of selected component (if applicable):
6.14 snap 22

How reproducible:
always

Steps to Reproduce:
1. create any type of webhook for any type of action, e.g. rex job running
2. perform the action while watching tail -f /var/log/foreman/production.log

Actual results:
hook is not triggered

Expected results:
hook is triggered

Additional info:
- sadly the qe automation is looking just for 'event received' line in logs, which is present here, so the tests didn't catch it
- judging by https://bugzilla.redhat.com/show_bug.cgi?id=2180760#c6, this was not occurring around snap 6

Comment 1 Peter Ondrejka 2023-11-02 14:42:47 UTC
OK, the problem was caused by the safemode setting being on, which prevented the template rendering, which was expected. Without safemode, the webhook is triggered as expected. Thanks to ofedoren for quick turnaround.