Problem:
After performing a distribution update (e.g., from SLES 15 SP6 to SP7), the hosts disappear from the respective host collection.
Since we execute job chains using the theforeman.foreman.job_invocation module (Stop SAP, Stop HANA, Update OS, Upgrade OS via dist-up, Start SAP, Start HANA) and refer to the host collection in the process, this is very disruptive.
Is this a bug or a feature? If this is intentional, why?
Expected outcome:
Hosts remain in the host collection after a service pack update.
Foreman and Proxy versions:
Foreman 3.15.0,
Proxy 3.15.0
Katello 4.17.1
Distribution and version:
Rocky Linux 9.6
Host collections are not altered unless the user asks for it. Is it possible one of your automations is calling a host collections API?
Also, make sure you’re following the API docs if so. I think one of the host collections endpoints requires you to send the entire list of hosts, rather than just a single host to add.
That was also my understanding regarding host collections. But the fact is that after an update from, for example, SuSE Linux Enterprise Server 15 SP6 to SP7, the host collection used for this is available but empty. The host collection is not affected in any way in the playbook or the roles.
One more thing: of course, the content view changes during the SLES distribution update. Could that be the reason?
No, as far as I know host collection membership is never automatically altered. That includes content view changes or any other changes to its hosts.
Here is my test scenario:
Initial situation:
After running /usr/sbin/subscription-manager unregister on abaplab01a:
After running /usr/sbin/subscription-manager register --org=MyOrg --activationkey=SLES-15-SP7-Key-Development on abaplab01a:
The host abaplab01a has disappeared from the host collection.
Activation keys can assign host collection membership. (I still consider this a user assignment, as users decide what activation keys do.)
Inspect the activation key “SLES-15-SP7-Key-Development” to see what host collections it assigns.
If it doesn’t assign “RunSAT-Testcollection”, the host will not be a member of that host collection.
If it doesn’t assign any host collections, the host will not be a member of any host collection.
The only way it would remain a member is if the “SLES-15-SP7-Key-Development” activation key assigned that host collection.
1 Like
The underlying question is, why are you unregistering and reregistering your host? Whatever you are accomplishing by doing this can be accomplished in another way, which would avoid the issue.