Fixes #39536 - preserve RAILS_LOG_TO_STDOUT in foreman-rake#11109
Open
Alleny244 wants to merge 1 commit into
Open
Fixes #39536 - preserve RAILS_LOG_TO_STDOUT in foreman-rake#11109Alleny244 wants to merge 1 commit into
Alleny244 wants to merge 1 commit into
Conversation
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #39536.
foreman-rakeruns Rails viarunuser -, which starts a login shell and clears most environment variables before switching to theforemanuser. As a result,RAILS_LOG_TO_STDOUTwas lost during install-time rake executions, causing Rails to fall back toproduction.logeven when stdout logging was intended.This change preserves
RAILS_LOG_TO_STDOUTacross therunuserinvocation. Container and RPM installs that set the variable now keep stdout logging throughout install-time rake boots and no longer create/var/log/foreman/production.log. Systems that do not setRAILS_LOG_TO_STDOUTcontinue using file logging as before.Related PR: theforeman/foreman-oci-images#66
Prerequisites for testing
foremanuser andrunuseravailableTesting scenarios
1. Verify
runuserpreserves the environment2. Verify
foreman-rakelogs to stdoutWith the patched
/usr/sbin/foreman-rake:rm -f /var/log/foreman/production.log RAILS_LOG_TO_STDOUT=true foreman-rake db:version ls /var/log/foreman/production.log # Expected: No such file or directoryBoot messages (for example,
Rails cache backend: File) should appear on stdout.3. Verify existing behavior is unchanged
Run
foreman-rakewithoutRAILS_LOG_TO_STDOUT:unset RAILS_LOG_TO_STDOUT foreman-rake db:versionRails should continue using
production.log, matching the existing behavior for traditional installations.