Bug 2079357

Summary: foreman-maintain maintenance-mode status command fails with `undefined method `maintenance_mode_status?' for nil:NilClass`
Product: Red Hat Satellite Reporter: sganar
Component: Satellite MaintainAssignee: Amit Upadhye <aupadhye>
Status: CLOSED ERRATA QA Contact: sganar
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: apatel, aupadhye, gtalreja, kgaikwad, zhunting
Target Milestone: 6.11.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-1.0.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-05 14:35:13 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:
Bug Depends On:    
Bug Blocks: 1693733, 2040650    

Description sganar 2022-04-27 12:46:46 UTC
Description of problem:
foreman-maintain maintenance-mode status command fails with `undefined method `maintenance_mode_status?' for nil:NilClass`

Version-Release number of selected component (if applicable):
Satellite 6.11.0 snap 17.0
rubygem-foreman_maintain-1.0.6-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. # foreman-maintain maintenance-mode status
2.
3.

Actual results:
fails with `undefined method `maintenance_mode_status?' for nil:NilClass`

Expected results:
command should pass

Additional info:

Comment 1 sganar 2022-04-29 08:40:26 UTC
Same is the error for command 
# foreman-maintain maintenance-mode is-enabled

Comment 2 Amit Upadhye 2022-05-02 16:01:12 UTC
Hello,

I don't see this happening with version 1.0.8, can you provide the foreman-maintain.logs or reproduce with latest version?

on el7

# foreman-maintain maintenance-mode status
Running Status of maintenance-mode
================================================================================
Check of maintenance-mode consistency: 
/ Running status of maintenance-mode                                            

Status of maintenance-mode: Off
- Iptables chain: absent
- sync plans: empty data
- cron jobs: not managed                                              [OK]
--------------------------------------------------------------------------------

[root@sat691 ~]# foreman-maintain maintenance-mode is-enabled
Running Show only status code of maintenance-mode
================================================================================
Showing status code for maintenance_mode: 
Maintenance mode is Off                                               [OK]
--------------------------------------------------------------------------------

1

on el8

# foreman-maintain maintenance-mode status
Running Status of maintenance-mode
================================================================================
Check of maintenance-mode consistency: 
/ Running status of maintenance-mode                                            

Status of maintenance-mode: Off
- Nftables table: absent
- sync plans: empty data
- cron jobs: not managed                                              [OK]
--------------------------------------------------------------------------------

[root@rhel8 ~]# foreman-maintain maintenance-mode is-enabled
Running Show only status code of maintenance-mode
================================================================================
Showing status code for maintenance_mode: 
Maintenance mode is Off                                               [OK]
--------------------------------------------------------------------------------

1

Comment 4 sganar 2022-05-25 08:13:37 UTC
Verified.

Tested on Satellite 6.11.0 Snap 21.0
rubygem-foreman_maintain-1.0.10-1.el8sat.noarch

Steps followed: 
1. # foreman-maintain maintenance-mode status
2. # foreman-maintain maintenance-mode is-enabled

Observation: 
No error, commands work fine

Comment 7 errata-xmlrpc 2022-07-05 14:35:13 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