Bug 1429418

Summary: foreman-rake gives warning: already initialized constant Katello::Ping::PACKAGES when running jobs
Product: Red Hat Satellite Reporter: Martijn ten Heuvel <mtenheuv>
Component: BrandingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.8CC: asahni, bbuckingham, bkearney, cdonnell, dhawke, egolov, fgarciad, hajek, h.teunis, inecas, jan.gerrit, jcallaha, kdixon, mmccune, nitthoma, pieter.vandewygaert, pmoravec, rplevka, sshtein, zhunting
Target Milestone: UnspecifiedKeywords: PrioBumpGSS, Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_theme_satellite-0.1.45-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1463804 (view as bug list) Environment:
Last Closed: 2017-08-10 17:02:29 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 Martijn ten Heuvel 2017-03-06 11:03:41 UTC
Description of problem:

Got an issue with clean up scripts I use. The script (example) is:
[root@satellite62 tasks]# pwd
/usr/share/foreman/lib/tasks
[root@satellite62 tasks]# cat clean_listenOn.rake 
namespace :katello do
  task :clean_listenOn => ["environment"] do
  User.current = User.first
  tasks = []
    puts "Cleaning listenOnCandlepinEvents...\n"
    ForemanTasks::Task.where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all
  end
end

The error I get is:
[root@satellite62 tasks]# service foreman-tasks stop
Redirecting to /bin/systemctl stop  foreman-tasks.service

[root@satellite62 tasks]# foreman-rake katello:clean_listenOn
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
Cleaning listenOnCandlepinEvents...

The error:
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here


Version-Release number of selected component (if applicable):
Satellite 6.2.8 upgraded from 6.2.7 today:

How reproducible:
Rerun cleanup job.

Steps to Reproduce:

Actual results:
The cleanup seems to be working, the warning should not be there.

Expected results:
The cleanup seems to be working, the warning should not be there.

Additional info:

Comment 1 Martijn ten Heuvel 2017-03-06 12:18:29 UTC
Starting console also gives warning.

[root@satellite62 ~]# foreman-rake console
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
/usr/share/foreman/lib/tasks/console.rake:4: warning: already initialized constant ARGV
Loading production environment (Rails 4.1.5)
irb(main):001:0>

Comment 2 Evgeni Golov 2017-03-06 13:34:55 UTC
This is also seen during .7→.8 upgrade:

Upgrade Step: migrate_foreman...
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
true

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
false

Comment 4 Craig Donnelly 2017-03-11 19:05:16 UTC
The definitions that is complaining about are as follows (slightly different):

/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7 ->

  7     PACKAGES = %w(katello candlepin pulp qpid foreman tfm hammer)

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4 ->

  4     self.const_set(:PACKAGES, %w(katello candlepin pulp qpid foreman tfm ham    mer satellite))

So they are different by a single package definition (satellite).

Comment 6 Jan Gerrit Kootstra 2017-04-05 15:49:15 UTC
Starting foreman-rake console gives also the mentioned error for me:

foreman-rake console
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
/usr/share/foreman/lib/tasks/console.rake:4: warning: already initialized constant ARGV
Loading production environment (Rails 4.1.5)

Comment 7 Ivan Necas 2017-04-07 12:52:49 UTC
This is a regression from https://bugzilla.redhat.com/show_bug.cgi?id=1329689, it's not fatal, but I agree the red herring messages are not nice.

Comment 8 Bryan Kearney 2017-04-11 18:35:24 UTC
*** Bug 1427673 has been marked as a duplicate of this bug. ***

Comment 9 Jan Gerrit Kootstra 2017-04-13 20:45:42 UTC
Red Hat Knowledge Base (Solution) 2980231 does not take into account that Trend Monitoring jobs are filling up root's mailbox with mails containing the messages:

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.41/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.105/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
true

It simply states to ignore the messages in system and application logs.
Logs are rotate, root's mailbox has to be cleared manually.

Comment 10 Jan Gerrit Kootstra 2017-05-04 04:38:01 UTC
Every 30 minutes I get an email from the trend analysis task with the same message. Still after upgrading to 6.2.9

Comment 14 Roman Plevka 2017-07-25 12:06:11 UTC
VERIFIED
on 6.2.11-2
yet, there's still the warning regarding the ARGV constant. B
[root@dell-per320-01 environments]# foreman-rake console
/usr/share/foreman/lib/tasks/console.rake:4: warning: already initialized constant ARGV
Loading production environment (Rails 4.1.5)
irb(main):001:0>

Comment 15 Roman Plevka 2017-07-25 12:13:04 UTC
opened a new BZ for the other warning:
https://bugzilla.redhat.com/show_bug.cgi?id=1474796

Comment 17 errata-xmlrpc 2017-08-10 17:02:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2466