bootstrap.py error

Latest response

Hello I have a new satellite server 6.2 and recently I am getting 422 error, I ran the satellite-installer and retried without success. Before this error started I was able to register few servers to satellite

My satellite server is 6.2 and running on RHEL7.4

any help would be appreciated

running the following command

./bootstrap.py -l MyAdminAccount -p MyPass -s satserver -o ORGANIZATION -L MyLocation -g "MyHostGroup" -a MyActivationKey --force

[NOTIFICATION], [2018-05-10 04:50:39], [Writing FQDN katello-fact]

[RUNNING], [2018-05-10 04:50:40], [Calling Foreman API to create a host entry associated with the group & org]
An error occured: HTTP Error 422: Unprocessable Entity
url: https://satmstprd1.nbme.org:443/api/v2/hosts/
code: 422
data: {
"host": {
"managed": "true",
"name": "iserver_san",
"ip": "172.21.64.35",
"hostgroup_id": 4,
"organization_id": 1,
"mac": "00:50:56:87:62:A6",
"architecture_id": 1,
"location_id": 2,
"domain_id": 1
}
}
error: {
"error": {
"errors": {
"interfaces.name": [
"is invalid"
],
"name": [
"is invalid"
]
},
"id": null,
"full_messages": [
"Name is invalid",
"Name is invalid"
]
}
}

Responses

As the error message states, your hostname is invalid. Hostnames, by RFC, cannot have underscores (_) in them. See https://en.wikipedia.org/wiki/Hostname.

You have two options to address this:

Change your hostname to be RFC compliant

Effectively, you'd change iserver_san to be iserver-san or something else.

Providing an arbitrary Fully Qualified Domain Name

Many users have either hostnames that are short (hostname -f or python's socket.getfqdn returns a hostname that isn't an FQDN) or non-RFC compliant (containing a character such as an underscore - which fails Foreman's hostname validation.

In many cases, the user cannot update his/her system to provide a FQDN. bootstrap.py provides the --fqdn which allows the user to specify the FQDN that will be reported to Foreman

Prerequisites

The user needs to set to False the create_new_host_when_facts_are_uploaded and create_new_host_when_report_is_uploaded options. If these options are not set, a host entry will be created based upon the facts provided by facter. This can be done with hammer.

hammer settings set \
  --name  create_new_host_when_facts_are_uploaded \
  --value false
hammer settings set \
  --name  create_new_host_when_report_is_uploaded \
  --value false

Example Usage

# hostname -f
node-100

# python -c 'import socket; print socket.getfqdn()'
node-100

# ./bootstrap.py -l admin \
    -s foreman.example.com \
    -o "Red Hat" \
    -L RDU \
    -g "RHEL7/Crash" \
    -a ak-Reg_To_Crash \
    --fqdn node-100.example.com

More documents on bootstrap.py can be found in Red Hat Satellite 6.2 Feature Overview: Importing Existing Hosts via the Bootstrap Script

Rich, thank you for the detailed information. Yes only this server is the one experiencing the problem. I tried another server that does not include "-" and it works ok. I guess I will make sure I dont have "-" in any new server I deploy.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.