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 1121986 - Logging initialized too late
Summary: Logging initialized too late
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Transitions
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Grant Gainey
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks: stargate-GA-tracker
TreeView+ depends on / blocked
 
Reported: 2014-07-22 09:28 UTC by Matej Kollar
Modified: 2019-09-26 14:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-11 12:21:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Matej Kollar 2014-07-22 09:28:25 UTC
Description of problem: When importing users (with no role-mapping file), import subcommand wants to log message "Role-mapping file ... not found, no roles will be assigned". This causes following traceback

NoMethodError (undefined method `log' for nil:NilClass):
    ./lib/hammer_cli_import/importtools.rb:220:in `log'
    ./lib/hammer_cli_import/importtools.rb:208:in `warn'
    ./lib/hammer_cli_import/user.rb:54:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:102
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

How reproducible: always/deterministic


Steps to Reproduce:
  1. either run subcommand without installation
     (RUBYOPT=-Ilib hammer ....) or remove  mapping file.
    RUBYOPT=-Ilib hammer -v import user --debug --csv-file /tmp/exports/users.csv --new-passwords newpws.csv

Actual results: program terminates with mentioned traceback.

Expected results: ...


Additional info: 

@logger is initialized in execute method. However, loading mapping file/checking stuff
is done in execute as well, and super is called only after this test.

Proposed solutions

  * move logger initialization into init (probably preferred as otherwise
    we would need to check other places where we override exec and this
    might cause complications in the future)
  * move mapping file checking/loading somewhere else

Comment 1 RHEL Program Management 2014-07-22 09:53:41 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Grant Gainey 2014-07-22 19:56:57 UTC
commit 54d9abcb3026718870c9623c279912906d84a0e2

Comment 4 Grant Gainey 2014-08-05 11:59:28 UTC
Moving logging-setup into init is a non-starter, because it relies on knowing the setting of the --debug option, and options aren't processed until after init :(

However, we fixed the issues that caused this BZ to be opened, by deciding to stop overriding execute().

See commit 610fc67318ba2501c531fbedec2b54be1ea6cd98 for 'removing execute overrides'

See commit 16d4cd6d68ad62c42b0981a05eefa83af9057471 for 'putting setup_logging back where it belongs'

Comment 7 Matej Kollar 2014-09-03 09:50:14 UTC
verified with rubygem-hammer_cli_import-0.10.3-1

Comment 8 Bryan Kearney 2014-09-11 12:21:57 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.


Note You need to log in before you can comment on or make changes to this bug.