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 2029828 - TFTP Storage check fails on undefined method `[]' for nil:NilClass
Summary: TFTP Storage check fails on undefined method `[]' for nil:NilClass
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.11.0
Assignee: Evgeni Golov
QA Contact: Gaurav Talreja
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-07 12:03 UTC by Evgeni Golov
Modified: 2022-07-05 14:31 UTC (History)
5 users (show)

Fixed In Version: rubygem-foreman_maintain-1.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:30:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34100 0 Normal New TFTP Storage check fails on undefined method `[]' for nil:NilClass 2021-12-07 14:17:24 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:31:02 UTC

Description Evgeni Golov 2021-12-07 12:03:37 UTC
Description of problem:

On a Satellite 7.0 with no Puppetserver deployed, foreman-maintain fails to restart the later in a weird fashion:

# foreman-maintain service restart --only puppetserver
undefined method `[]' for nil:NilClass


Version-Release number of selected component (if applicable):
rubygem-foreman_maintain-0.9.3-1.el7sat.noarch

How reproducible:
100% 

Steps to Reproduce:
1. foreman-maintain service restart --only puppetserver

Actual results:
undefined method `[]' for nil:NilClass

Expected results:
Something that tells the user "can't do this, there is no puppetserver"

Additional info:

Comment 1 Evgeni Golov 2021-12-07 13:32:13 UTC
oooh, this is different

the error happens for *any* call of `foreman-maintain` with `--only` ?!

# foreman-maintain service restart --only foreman
undefined method `[]' for nil:NilClass

# foreman-maintain service start --only foreman
undefined method `[]' for nil:NilClass

seems to affect start/stop/restart, status is fine:

# foreman-maintain service status --only foreman
Running Status Services
================================================================================
Get status of applicable services: 

Displaying the following service(s):
foreman
| displaying foreman                                                            
● foreman.service - Foreman
   Loaded: loaded (/usr/lib/systemd/system/foreman.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/foreman.service.d
           └─installer.conf


# foreman-maintain service status --only puppetserver
Running Status Services
================================================================================
Get status of applicable services: 

Displaying the following service(s):                                  [FAIL]
No service found matching your parameter 'puppetserver'

Comment 2 Evgeni Golov 2021-12-07 14:14:55 UTC
okay, the error is somewhere completely else, it just gets bubbled up here.

the problem is in ./definitions/checks/foreman_proxy/check_tftp_storage.rb:

    def self.lookup_token_duration
      data = feature(:foreman_database). \
             query("select s.value, s.default from settings s \
                    where category = 'Setting::Provisioning' and name = 'token_duration'")
      YAML.load(data[0]['value'] || data[0]['default'])
    end

but `data` is `[]`, so `data[0]` is nil and `nil['value']` gets you the nice error

Comment 3 Evgeni Golov 2021-12-07 14:17:23 UTC
Created redmine issue https://projects.theforeman.org/issues/34100 from this bug

Comment 4 Gaurav Talreja 2022-02-22 10:20:32 UTC
Verified.

Tested on Satellite 7.0 Snap 10.0 for both EL7 and EL8 installations
Version: rubygem-foreman_maintain-1.0.3-1.el8sat.noarch

Steps:
1. foreman-maintain service stop --only foreman
2. foreman-maintain service start --only foreman
3. foreman-maintain service status --only foreman
4. foreman-maintain service restart --only foreman

Observation:
foreman-maintain service stop/start/status/restart works fine with --only option with no errors

Comment 8 errata-xmlrpc 2022-07-05 14:30:51 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 (Moderate: Satellite 6.11 Release), 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/RHSA-2022:5498


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