Bootstrap host registration failure - Name has already been taken

Problem:
Using boostratp.py register hosts to Foreman results in HTTP Error 422:
“Unprocessable Entity”,
“url” https://foreman.example.com:443/api/v2/hosts",
“code 422”, "data:: {
“host”: {
“managed”: “true”,
“name”: “client”,
“ip”: xx.xx.xx.xx,
“hostgroup_id”: 2,
“organization_id”: 1,
“mac”: “xx:xx:xx:xx:xx:xx”,
“architecture_id”: 1,
“location_id”: 1,
“domain_id”: 1
}
}
error: {
“error”: {
“errors”: {
“name”: ["has already been taken ]
},
“id”: null,
“full_messages”: [
“Name has already been taken”
]
}
}
Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:
Foreman 2.1.4
Katello 3.16
Other relevant data:

  1. I used to have this server registered in Foreman but has since been removed. I am wondering if the error is due to that but;
  2. I have looked into the location_id , hostgroup_id, organization_id specified i cant seem to find the mentioned host name.
  3. Host search feature in foreman-rake console also returned “nil” when searching for the corresponding terms.

Hi @pineapplebun,

Thanks for raising this. Looking at similar issues, I found this as a suggested solution:

  • Check if the puppet-agent was configured on the client and the stale entry is still available under /etc/puppetlabs/puppet/ssl.
  • If the stale entry is still available then clear the old certs from /etc/puppetlabs/puppet/ssl and try to re-register the client.

Can you check if this solves the issue for you?

Hi @sajha,

Really appreciate your response. I have followed your steps on both my Foreman client and the host I am trying to register but it is still unsuccessful.

Here’s more additional information that you might help:

  1. Manually registering the host with the name on Foreman client (hosts > create host) will return “has already taken” for the name field.

I believe the stale record should be within the Foreman Host server, any idea on how i might be able to cleanse it?

Thanks

Hey, did you try looking outside the given Organization/Location? One can construct cases where a host entry will be created without any Org/Loc assignment and then if you look inside you won’t find them, but the “not unique” check will still fail.

hey @evgeni,

Yes I have cycled through different organizations and locations combinations to check for an instance of the host name. Is hasn’t been fruitful.