Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-34713

foreman-rake rh_cloud:hybridcloud_register task is broken

XMLWordPrintable

    • 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.

              rhn-support-chrobert Chris Roberts
              jaudet@redhat.com Jeremy Audet
              Chris Roberts Chris Roberts
              Jeremy Audet Jeremy Audet
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: