Bug 2164080

Summary: Upgrade will fail during check-tftp-storage check with "no implicit conversion of nil into String"
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: UpgradesAssignee: Eric Helms <ehelms>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ehelms, zhunting
Target Milestone: 6.13.0Keywords: Triaged, UpgradeBlocker, Upgrades
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:24:34 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 Lukas Pramuk 2023-01-24 17:46:46 UTC
Description of problem:
Upgrade will fail during check-tftp-storage check with "no implicit conversion of nil into String"

Running preparation steps required to run the next scenarios
================================================================================
Check whether system has any non Red Hat repositories (e.g.: EPEL) enabled: 
- Checking repositories enabled on the system                         [OK]      
--------------------------------------------------------------------------------


Running Checks before upgrading to Satellite 6.13
================================================================================
Clean old Kernel and initramfs files from tftp-boot:                  [FAIL]
no implicit conversion of nil into String
...

Version-Release number of selected component (if applicable):
6.13.0 Snap 7
rubygem-foreman_maintain-1.2.3-1.el8sat.noarch

How reproducible:
deterministic

Steps to Reproduce:
1. Upgrade to 6.13 
# satellite-maintain upgrade check --target-version 6.13

Actual results:
upgrade check fails

Expected results:
upgrade check succeeds

Additional info:
https://github.com/theforeman/foreman_maintain/blob/v1.2.3/definitions/checks/foreman_proxy/check_tftp_storage.rb#L45-L48

data[0] is nil , db query needs to be adapted to 6.13

foreman=> select s.value, s.default from settings s; 
ERROR:  column s.default does not exist
LINE 1: select s.value, s.default from settings s;

Comment 1 Lukas Pramuk 2023-01-24 17:52:43 UTC
foreman=> select * from settings s limit 1; 
 id  |    name     |                  value                   | category |         created_at         |         updated_at         
-----+-------------+------------------------------------------+----------+----------------------------+----------------------------
 250 | instance_id | --- 33c17ca5-e118-5a45-b9d3-7ac40c9a6ef7+| Setting  | 2020-04-23 00:36:48.861129 | 2023-01-24 10:55:53.672493


whoa no 'default' column !!!

Comment 6 Lukas Pramuk 2023-01-25 15:59:49 UTC
6.12.0 (prior upgrade) 


foreman=> select s.value, s.default from settings s where category IN ('Setting::Provisioning','Setting')  and name = 'token_duration';
 value | default 
-------+---------
       | --- 360+
       | ...    +
       | 
(1 row)


vs.

6.13.0 (upgraded)

 foreman=> select s.value, s.default from settings s where category IN ('Setting::Provisioning','Setting')  and name = 'token_duration';
ERROR:  column s.default does not exist
LINE 1: select s.value, s.default from settings s where category IN ...
                        ^

Comment 7 Eric Helms 2023-01-25 16:53:26 UTC
Created redmine issue https://projects.theforeman.org/issues/35998 from this bug

Comment 8 Bryan Kearney 2023-01-31 08:03:29 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35998 has been resolved.

Comment 9 Lukas Pramuk 2023-02-03 13:29:27 UTC
VERIFIED.

@Satellite 6.13.0 Snap 9
rubygem-foreman_maintain-1.2.4-1.el8sat.noarch

by the upgrade automation running 6.12.1 -> 6.13.0 upgrade

# foreman-maintain upgrade check --plaintext --whitelist="repositories-validate" --target-version 6.13 -y
...

Running Checks before upgrading to Satellite 6.13
================================================================================
Clean old Kernel and initramfs files from tftp-boot:                  [OK]
--------------------------------------------------------------------------------
...

>>> check-tftp-storage check is now passing successfully

Comment 12 errata-xmlrpc 2023-05-03 13:24:34 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 (Important: Satellite 6.13 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-2023:2097