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
Upstream bug assigned to aruzicka
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35894 has been resolved.
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.