Bug 2227869 - Satellite is not able to pick settings which transitioned from a non-default to default value
Summary: Satellite is not able to pick settings which transitioned from a non-default ...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Settings
Version: 6.11.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 6.12.5
Assignee: Adam Ruzicka
QA Contact: visawant
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-31 18:00 UTC by Odilon Sousa
Modified: 2023-08-11 21:18 UTC (History)
2 users (show)

Fixed In Version: foreman-3.3.0.22-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35894 0 Normal Closed Foreman.settings.load_values is not able to pick settings which transitioned from a non-default to default value 2023-07-31 18:02:13 UTC
Red Hat Bugzilla 2157869 0 unspecified CLOSED Satellite is not able to pick settings which transitioned from a non-default to default value 2023-07-31 18:02:13 UTC
Red Hat Issue Tracker SAT-19281 0 None None None 2023-07-31 18:02:23 UTC

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.


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