Project

General

Profile

Actions

Bug #38492

closed

Printing output in profile.d breaks local DB detection

Added by Evgeni Golov 20 days ago. Updated 20 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
foreman-installer script
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:

  • Install a Katello 4.14 normally
  • Create /etc/profile.d/tmout.sh with the following content. 
    TMOUT=900
    readonly TMOUT
    export TMOUT{code}
    
  • Logout and log back in
  • Try to upgrade to Katello 4.16
     

Actual Behavior:

The upgrade starts fine but when installer is finally executed, The pre-hook fails to fix the ownership of evr extension:

2025-05-12 10:56:39 [DEBUG ] [root] Executing: runuser -l postgres -c psql\ -t\ -c\ \"SELECT\ 1\ FROM\ pg_database\ WHERE\ datname\ \=\ \'foreman\'\;\" 
2025-05-12 10:56:40 [DEBUG ] [root] /etc/profile.d/tmout.sh: line 2: TMOUT: readonly variable
2025-05-12 10:56:40 [DEBUG ] [root]         1
2025-05-12 10:56:40 [DEBUG ] [root] 
2025-05-12 10:56:40 [NOTICE] [pre] The Foreman database foreman does not exist.
2025-05-12 10:56:40 [DEBUG ] [pre] Hook /usr/share/foreman-installer/hooks/pre/35-change-evr-extension-ownership.rb returned true{code}

 

That further results in failure during the db:migrate step

2025-05-12 11:03:03 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2025-05-12 11:03:03 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2025-05-12 11:03:53 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2025-05-12 11:03:53 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2025-05-12 11:05:03 [NOTICE] [configure] 2500 configuration steps out of 2515 steps complete.
2025-05-12 11:05:10 [NOTICE] [configure] System configuration has finished.
Error 1: Puppet Exec resource 'foreman-rake-db:migrate' failed. Logs:
  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]
    Adding autorequire relationship with User[foreman]
    Starting to evaluate the resource (2268 of 2515)
    Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
    '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
    Evaluated in 107.70 seconds
  Exec[foreman-rake-db:migrate](provider=posix)
    Executing check '/usr/sbin/foreman-rake db:abort_if_pending_migrations'
    Executing '/usr/sbin/foreman-rake db:migrate'
    Executing check '/usr/sbin/foreman-rake db:abort_if_pending_migrations'
    Executing '/usr/sbin/foreman-rake db:migrate'
..
..
    Run `bin/rails db:migrate` to update your database then try again.
    You have 14 pending migrations:
      20240924161240 KatelloRecreateEvrConstructs
      20241007200316 AddFieldsToKatelloDockerManifestList
      20241007212705 AddBootcFactsToContentFacet
      20241022121706 AddSyncDependenciesOption
      20241025151105 RemovePulp3MigratedHrefsFromContentTables
      20241030181402 CreateKatelloFlatpakTables
      20241101144625 RemoveSystemPurposeAddons
      20241107002541 AddRegistryURLToKatelloFlatpakRemotes
      20241112145802 AddManifestEntityToContentFacets
      20241120213713 AddAllowOtherTypesToContentViewErratumFilterRules
      20241126150849 RemoveRemoteExecutionWorkersPoolSize
      20241206183052 AddContentTypeToContainerManifestsAndLists
      20241217190624 AddUniqueIndexToRuleIdAndHostIdInInsightsHits
      20241220184900 ChangeSyncInsightsRecommendationsToTrue
  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns
    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:
        PG::InsufficientPrivilege: ERROR:  must be owner of extension evr
    /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec'
    /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
    /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'

 

 

Expected Behavior:

No such issues at all. 

Actions #1

Updated by The Foreman Bot 20 days ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-installer/pull/1026 added
Actions #2

Updated by The Foreman Bot 20 days ago

  • Fixed in Releases 3.16.0 added
Actions #3

Updated by Evgeni Golov 20 days ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF