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 2231868

Summary: Customer upgrade fails once during db:seed with NameError: uninitialized constant WebhookTemplate
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: Hooks and WebhooksAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.14.0CC: aruzicka, ehelms, lvrtelov, rlavi
Target Milestone: UnspecifiedKeywords: Triaged, Upgrades
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-08-29 11:08:43 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:

Description Lukas Pramuk 2023-08-14 14:01:51 UTC
Description of problem:
Customer upgrade fails for the first time during db:seed with NameError: uninitialized constant WebhookTemplate
Afterwards upgrade re-run finishes successfully

Version-Release number of selected component (if applicable):
6.14.0

How reproducible:
deterministic using specific customer data

Steps to Reproduce:
1. Upgrade to 6.14

# satellite-maintain upgrade run --whitelist=repositories-validate,repositories-setup --target-version 6.14 -y
...
All services stopped                                                  [OK]
--------------------------------------------------------------------------------
Update package(s) :                                                   [OK]
--------------------------------------------------------------------------------
Procedures::Installer::Upgrade:                                       [FAIL]
Failed executing satellite-installer, exit status 6:
2023-08-02 21:26:49 [NOTICE] [root] Loading installer configuration. This will take some time.
2023-08-02 21:26:52 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2023-08-02 21:26:52 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
Package versions are locked. Continuing with unlock.
2023-08-02 21:26:58 [NOTICE] [configure] Starting system configuration.
2023-08-02 21:27:10 [NOTICE] [configure] 250 configuration steps out of 1640 steps complete.
2023-08-02 21:27:12 [NOTICE] [configure] 500 configuration steps out of 2491 steps complete.
2023-08-02 21:27:13 [NOTICE] [configure] 750 configuration steps out of 2491 steps complete.
2023-08-02 21:27:13 [NOTICE] [configure] 1000 configuration steps out of 2491 steps complete.
2023-08-02 21:27:13 [NOTICE] [configure] 1250 configuration steps out of 2491 steps complete.
2023-08-02 21:27:24 [NOTICE] [configure] 1500 configuration steps out of 2493 steps complete.
2023-08-02 21:27:29 [NOTICE] [configure] 1750 configuration steps out of 2497 steps complete.
2023-08-02 21:27:30 [NOTICE] [configure] 2000 configuration steps out of 2502 steps complete.
2023-08-02 21:27:36 [NOTICE] [configure] 2250 configuration steps out of 2502 steps complete.
2023-08-02 21:29:00 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2023-08-02 21:29:00 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2023-08-02 21:29:34 [NOTICE] [configure] 2500 configuration steps out of 2502 steps complete.
2023-08-02 21:29:39 [NOTICE] [configure] System configuration has finished.


Actual results:
first upgrade fails and upgrade re-run is passing

Expected results:
upgrades are passing starting with the first upgrade


Additional info:
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: rake aborted!
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'WebhookTemplate'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:182:in `rescue in sti_class_for'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:175:in `sti_class_for'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:259:in `find_sti_class'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:247:in `discriminate_class_for_record'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/persistence.rb:257:in `instantiate'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `block (2 levels) in find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `block in each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `map'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `block in find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:61:in `find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:843:in `block in exec_queries'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:861:in `skip_query_cache_if_necessary'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:828:in `exec_queries'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:631:in `load'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:249:in `records'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation/delegation.rb:88:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/foreman/app/models/taxonomy.rb:228:in `group_by'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/foreman/app/models/taxonomy.rb:228:in `assign_default_templates'
...
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: Caused by:
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: NameError: uninitialized constant WebhookTemplate
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/foreman_hooks-0.3.17/lib/foreman_hooks/as_dependencies_hook.rb:4:in `load_missing_constant'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb:274:in `const_get'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb:274:in `constantize'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:177:in `sti_class_for'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:259:in `find_sti_class'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/inheritance.rb:247:in `discriminate_class_for_record'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/persistence.rb:257:in `instantiate'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `block (2 levels) in find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `block in each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/result.rb:62:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `map'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:63:in `block in find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/querying.rb:61:in `find_by_sql'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:843:in `block in exec_queries'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:861:in `skip_query_cache_if_necessary'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:828:in `exec_queries'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:631:in `load'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation.rb:249:in `records'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/activerecord-6.1.7/lib/active_record/relation/delegation.rb:88:in `each'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/foreman/app/models/taxonomy.rb:228:in `group_by'
2023-08-10 09:10:57 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/foreman/app/models/taxonomy.rb:228:in `assign_default_templates'
...

Comment 6 Lukas Pramuk 2023-08-29 11:08:43 UTC
This BZ is caused by inconsistency arised during DB anonymization process.
(webhook plugin is enabled in the DB but disabled in installer answerfile)

After sanitizing the backup an upgrade has finished successfully.