Bug 2227869

Summary: Satellite is not able to pick settings which transitioned from a non-default to default value
Product: Red Hat Satellite Reporter: Odilon Sousa <osousa>
Component: SettingsAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: visawant
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.11.4CC: rlavi, shwsingh
Target Milestone: 6.12.5Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-3.3.0.22-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-24 18:24:35 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 Odilon Sousa 2023-07-31 18:00:31 UTC
This bug was initially created as a copy of Bug #2154184

Satellite is not able to detect when a setting changes from a non-default to
default value and if such a change happens, it continues using the non-default
one until services are restarted. This affects all releases from 6.11 onwards.

Steps to reproduce:
1) Run rails console
2) Pick a $setting without custom value
3) Read a value of $setting with Setting[$setting]
4) In another process, change the value of $setting to a non-default one
5) Reload the settings with Foreman.settings.load_values
6) Repeat 3, notice the value is what was set in 4
6) In another process, change the value of $setting to the default one
7) Repeat 5
8) Repeat 3

Actual results:
The value in 8 is the same as in 6

Expected results:
The value in 8 is the same as in 3

Comment 1 Bryan Kearney 2023-07-31 20:03:37 UTC
Upstream bug assigned to aruzicka

Comment 2 Bryan Kearney 2023-07-31 20:03:38 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35894 has been resolved.

Comment 4 visawant 2023-08-10 11:30:38 UTC
Verified


Version tested:
---------------
Satellite 6.12.5 Snap 2.0


Steps performed:
----------------
1) Run rails console
~~~
[root@ip-fqdn ~]# foreman-rake console
Loading production environment (Rails 6.0.6)
irb(main):001:0>
~~~

2) Pick a $setting without custom value
I chose "instance_title", which can be seen on web UI at Administer > Settings > General tab with Name "Instance title"
~~~
irb(main):001:0> $seting = 'instance_title'
=> "instance_title"
~~~

3) Read a value of $setting with Setting[$setting]
~~~
irb(main):002:0>  Setting[$seting]
=> nil
~~~

4) In another process, change the value of $setting to a non-default one
I preferred hammer cli command, which can also be changed from web UI
~~~
# hammer setting set --name instance_title --value my_custom_instance
# hammer --output=table setting info --name instance_title
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|-------------------
ID             | NAME           | DESCRIPTION                                                                     | CATEGORY | SETTINGS TYPE | VALUE             
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|-------------------
instance_title | instance_title | The instance title is shown on the top navigation bar (requires a page reload). | General  | string        | my_custom_instance
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|-------------------
~~~

5) Reload the settings with Foreman.settings.load_values
~~~
irb(main):003:0> Foreman.settings.load_values
=> Thu, 10 Aug 2023 10:49:32 UTC +00:00
~~~

6) Repeat 3, notice the value is what was set in 4
~~~
irb(main):004:0>  Setting[$seting]
=> "my_custom_instance"
~~~

6) In another process, change the value of $setting to the default one
~~~
# hammer --output=table setting set --name instance_title --value ""
Setting [instance_title] updated to [].
# hammer --output=table setting info --name instance_title
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|------
ID             | NAME           | DESCRIPTION                                                                     | CATEGORY | SETTINGS TYPE | VALUE
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|------
instance_title | instance_title | The instance title is shown on the top navigation bar (requires a page reload). | General  | string        |      
---------------|----------------|---------------------------------------------------------------------------------|----------|---------------|------
~~~

7) Repeat 5
~~~
irb(main):005:0> Foreman.settings.load_values
=> Thu, 10 Aug 2023 11:16:36 UTC +00:00
~~~

8) Repeat 3
~~~
irb(main):006:0>  Setting[$seting]
=> ""
~~~


Additional details:
-------------------
Value which is in step-8 was set in step-6 (i.e ""), which is obvious if we are expecting value same as step-3 i.e "nil" then need to reset it from database.

Comment 9 errata-xmlrpc 2023-08-24 18:24:35 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 (Satellite 6.12.5 Async Update), 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-2023:4749