Subscription-manager register fails with Medium can't be blank

Problem:
When running

subscription-manager register --org “MyOrg” --activationkey “MyActivationKey” --force

on 3 of our existing hosts we get the following error:

Validation failed: Medium can’t be blank (HTTP error code 422: Unprocessable Entity)

Configuration summary:

For specific reasons, these 3 hosts are in network zone A, our Smartproxy server is in network zone B and our Foreman server is in network zone C. The 3 zones are separated by a firewall. We’ve set FW rules to allow traffic on port 80, 443 and 9090 between these 3 hosts and our smartproxy server.

Notes:

  1. The command runs successfully for all our other hosts which are within the same network zone as our smartproxy server.
  2. We get the same error when generating a command in Foreman via the “Register Host” page.
  3. Our hosts aren’t assigned a Media as we use Synced Content.

Foreman Production log shows the following entries when running the command:

2024-08-07T07:17:37 [I|app|e450ed11] Started POST “/rhsm/consumers?owner=MyOrg&activation_keys=MyActivationKey” for x.x.x.x at 2024-08-07 07:17:37 -0500
2024-08-07T07:17:37 [I|app|e450ed11] Processing by Katello::Api::Rhsm::CandlepinProxiesController#consumer_activate as JSON
2024-08-07T07:17:37 [I|app|e450ed11] Parameters: {“type”=>“system”, “name”=>“pl-proxy.cscscience.ca”, “facts”=>“[FILTERED]”, “contentTags”=>, “role”=>“”, “addOns”=>, “usage”=>“”, “serviceLevel”=>“”, “owner”=>“MyOrg”, "$2024-08-07T07:17:37 [W|app|e450ed11] Not queueing Host::Managed: [“Medium can’t be blank”]
2024-08-07T07:17:37 [W|app|e450ed11] Not queueing Host::Managed: [“Medium can’t be blank”]
2024-08-07T07:17:37 [W|app|e450ed11] Not queueing Host::Managed: [“Medium can’t be blank”]
2024-08-07T07:17:37 [W|app|e450ed11] Not queueing Discovery reboot: Medium can’t be blank
2024-08-07T07:17:37 [E|kat|e450ed11] ActiveRecord::RecordInvalid
2024-08-07T07:17:37 [E|kat|e450ed11] medium_id: [“can’t be blank”]
2024-08-07T07:17:37 [I|app|e450ed11] Completed 422 Unprocessable Entity in 227ms (Views: 1.0ms | ActiveRecord: 18.7ms | Allocations: 65942)

Are there other ports which needs to be open or maybe something else entirely we should look into?

Expected outcome:
Registration command should run successfully.

Foreman and Proxy versions:
Foreman 3.10 and Katello 4.12

Foreman and Proxy plugin versions:

Distribution and version:
AlmaLinux 8

Other relevant data:

This looks like Bug #37599: Don't clear KS repo when reregistering host - Katello - Foreman

That fix will be in Katello 4.14 when it’s released.

Thank you @jeremylenz for this information, however it does not quite explain why the command succeeds on existing hosts which are in the same network zone as our smartproxy server.

It’s a backend data issue, technically hosts do get assigned Media even when using Synced Content. The medium gets cleared during unregistration, which breaks the Host record and causes the error. “Unregistration” was occurring when forcing the host to reregister.