-
Bug
-
Resolution: Done
-
Normal
-
6.16.5.1, 6.17.0.1
-
2
-
False
-
Moderate
-
Phoenix Sprint 150, Phoenix Sprint 151, Proton Sprint 2
-
sat-proton
-
None
-
None
-
None
-
Manual
-
Yes
Description of problem:
Satellite offers a rake task for registering a satellite organization to a custom Insights instance. Unfortunately, it's broken on account of ignoring environment variables:
# SATELLITE_RH_CLOUD_URL=https://example.com org_id=3 foreman-rake rh_cloud:hybridcloud_register E, [2025-06-04T14:26:44.360083 #1322275] ERROR -- : ERROR: org_id needs to be specified.
This happens because /usr/sbin/foreman-rake executes runuser - …, which unsets most environment variables. runuser(1) says the -, -l, --login flag "clears all the environment variables except for TERM and variables specified by --whitelist-environment". Here's the line of code, introduced in this commit:
runuser - foreman -s /bin/bash -c 'RUBYOPT=-W0 RAILS_ENV=production "$0" "$@"' -- $CMD "$@"
If I change runuser - to runuser, the command superficially works as intended:
# SATELLITE_RH_CLOUD_URL=https://example.com org_id=3 foreman-rake rh_cloud:hybridcloud_register Paste your token, output will be hidden.
How reproducible:
Always.
Is this issue a regression from an earlier version:
Yes.
Steps to Reproduce:
See description.
Actual behavior:
See description.
Expected behavior:
See description.
Business Impact / Additional info:
When considering a solution, please ensure SATELLITE_RH_CLOUD_URL can also be customized. Possible solutions include:
- Change runuser - to runuser in /usr/sbin/foreman-rake.
- Make the rake task prompt for needed variables.