Bug 1365820

Summary: Document "report" renamed to "config_report" for foreman hooks plugin (6.2 upgrade step)
Product: Red Hat Satellite Reporter: Javier Ramirez <javier.ramirez>
Component: Docs Install GuideAssignee: Stephen Wadeley <swadeley>
Status: CLOSED CURRENTRELEASE QA Contact: Brandi Munilla <bmcelvee>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: adahms, javier.ramirez, jentrena, lzap, pdwyer
Target Milestone: UnspecifiedKeywords: Regression
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
Rails events no longer triggering hooks in /hooks/report In Satellite 6.2 the Report class is changed to ConfigReport so the hooks are no longer looking for a script stored in the /hooks/report/ directory. Create a directory /usr/share/foreman/config/hooks/config_report/ and move hooks such as `after_create` and `before_create` to the new directory.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-26 06:23:26 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:
Bug Depends On:    
Bug Blocks: 1115190    

Description Javier Ramirez 2016-08-10 09:40:09 UTC
Description of problem:
After upgrading to 6.2 report 'after_create' hook no longer running.

Version-Release number of selected component (if applicable):
tfm-rubygem-foreman_hooks-0.3.11-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create /usr/share/foreman/config/hooks/report/after_create/10-test with the following content

#!/bin/sh

logger "Testing after_create hooks"

exit 0

2. Use puppet to trigger the hook execution in a client:

puppet agent -t --server satellite.example.com

Actual results:

The hook is not executed.

Expected results:

The hook to be executed.

Additional info:

In 6.2 Report class is changed into ConfigReport so the hooks are not looking into the script which is stored into report directory.

So if you create /usr/share/foreman/config/hooks/config_report/after_create/10-test 

It works.

Comment 1 Javier Ramirez 2016-08-10 09:46:16 UTC
I'm marking this as a regression since this change made code working on previous versions unusable.

This change is also undocumented, so there is no way that customers could ammend their hooks.

I suspect that this is going to be a general issue, since many customers will be using their own scripts for after_create hooks.

Comment 2 Lukas Zapletal 2016-08-11 08:18:16 UTC
Thanks, I confirm. This is good DOCO ERRATA candidate for specific 6.2 upgrade instructions.

Comment 3 Andrew Dahms 2016-09-13 01:16:51 UTC
Assigning to Stephen for review.

Stephen - given the nature of this bug, one approach that comes to mind is to describe the issue in the doc text field and make this a known issue release note so that it is called out there.

What do you think?

Comment 5 Stephen Wadeley 2016-09-13 10:52:08 UTC
report(In reply to Andrew Dahms from comment #3)
> Assigning to Stephen for review.
> 
> Stephen - given the nature of this bug, one approach that comes to mind is
> to describe the issue in the doc text field and make this a known issue
> release note so that it is called out there.
> 
> What do you think?

Hello

I agree, I think that is essential.

I greped all the guides, I could not find "hooks/report", which suggests there is no example or procedure that needs correcting.

I found `after_create` mentioned in "Rails Events" under "Using Foreman Hooks" in the Server Administration Guide[1]

But if you scroll up and look at the end of "Procedure 10.1. Creating a Foreman Hook to Use the logger Command" you will see:


This command output also lists some technical tables which are unlikely to be used with Foreman Hooks, for example "active_record" or "habtm". These are most commonly used:

    host
    report 

I think that is the "report" in question. 

[1] https://access.redhat.com/documentation/en/red-hat-satellite/6.2/paged/server-administration-guide/102-using-foreman-hooks#sect-Red_Hat_Satellite-Server_Administration_Guide-Red_Hat_Satellite_Foreman_Hooks_Rails_Events

Comment 6 Stephen Wadeley 2016-09-13 11:02:10 UTC
(In reply to Stephen Wadeley from comment #5)
> report(In reply to Andrew Dahms from comment #3)
> > Assigning to Stephen for review.
> > 
<snip>

> 
> This command output also lists some technical tables which are unlikely to
> be used with Foreman Hooks, for example "active_record" or "habtm". These
> are most commonly used:
> 
>     host
>     report 
> 
> I think that is the "report" in question. 
> 
In my test VM for Sat6.2.1

I started foreman-rake console and entered:
ActiveRecord::Base.descendants.collect(&:name).collect(&:underscore).sort

in the output I see "config_report" and later just "report". So now I am unsure.

Comment 10 Stephen Wadeley 2016-09-15 09:12:12 UTC
Hello lzap

Can you read comment 5 and see if there is anything more I should add or change in the guide at the link provided?

Is there someone else I should ask about this?


Thank you

Comment 11 Lukas Zapletal 2016-09-22 11:19:13 UTC
No this is right, make it an Upgrade note for 6.2 only. It's really only ConfigReport model that was renamed, nothing else AFAIK.

Comment 12 Stephen Wadeley 2016-09-22 13:50:58 UTC
Thank you lzap

I have added some text to the "Upgrading Satellite Server and Capsule Server" with title "Foreman Hooks' Report Class Renamed to ConfigReport"