ERROR: HTTP error (422 — Unknown): Validation failed: Name has already been taken
If you encounter this message while registering a host then follow below troubleshooting steps:
STEP1:
subscription-manager remove — all
subscription-manager unregister
subscription-manager clean
Still not able to resolve the issue, follow next step
STEP2:
Go to the Satellite portal and delete the hosts. Do hammer list:
hammer host list | grep 'host.eample.com'
hammer host delete --id <host_id> --organization <org_name>
If still not working, perform the below steps.
STEP3:
su - postgres -c 'psql foreman -c "select id,name,type from hosts where name = '\''host.example.com'\'';"'foreman-rake console> h = Host.find_by_id(I)> h.disassociate!> HostStatus::Status.where(host_id: I).delete_all> h.subscription_facet.destroy> h.content_facet.destroy> h.destroy> Host.find_by_id(I)> exit
Now try to register your host.