>
> Name has already been taken - this usually means that host (either 
> discovered or managed or unmanaged) of that name "macXXXXXXXXX" already 
> exist. Same mac address? You can change easily how discovered hosts are 
> being named, by default it is "mac" + MAC address, you can change that to 
> random number or any different fact you want. See settings and our 
> documentation. Try to add a random number at the end if that helps.
>

Well, no, that's the same host. It was discovered at some point back (8 
days ago as you can see in the screenshot above). Then it got 
rebooted/crashed, PXE-booted again and started sending its discovery 
payload again, but gets 422. Usually, if it is the same host, Foreman just 
updates existing entry with new facts, or at least, the time of last 
report. But in the case above, that did not happen as for some reason 
Foreman created another record in a DB (with a different ID) for the same 
host. Unless I remove both of the records, 422s will continue to happen. I 
was hoping that a gist I provided gives you enough info on what could have 
caused that double-record situation for the same host.

Here are my DB entries for the above host:

[root@spc03 ~]# mysql -u foreman -p$DB_PASS foreman -e "SELECT * from hosts 
where type = 'Host::Discovered' and NAME = 'mac90e2baea5d58'\G;"
*************************** 1. row ***************************
                  id: 446735
                name: mac90e2baea5d58
        last_compile: NULL
         last_report: 2017-10-02 05:49:35
          updated_at: 2017-10-02 05:49:46
          created_at: 2017-09-15 22:44:42
           root_pass: NULL
     architecture_id: NULL
  operatingsystem_id: NULL
      environment_id: NULL
           ptable_id: NULL
           medium_id: NULL
               build: 0
             comment: NULL
                disk: NULL
        installed_at: NULL
            model_id: 6
        hostgroup_id: NULL
            owner_id: 10
          owner_type: User
             enabled: 1
  puppet_ca_proxy_id: NULL
             managed: 0
           use_image: NULL
          image_file: NULL
                uuid: NULL
 compute_resource_id: NULL
     puppet_proxy_id: NULL
            certname: NULL
            image_id: NULL
     organization_id: NULL
         location_id: NULL
                type: Host::Discovered
                 otp: NULL
            realm_id: NULL
  compute_profile_id: NULL
    provision_method: NULL
           grub_pass:
       global_status: 0
lookup_value_matcher: NULL
   discovery_rule_id: NULL
       salt_proxy_id: NULL
 salt_environment_id: NULL
          pxe_loader: NULL
*************************** 2. row ***************************
                  id: 456978
                name: mac90e2baea5d58
        last_compile: NULL
         last_report: 2017-10-10 16:04:20
          updated_at: 2017-10-10 16:04:20
          created_at: 2017-10-07 07:13:19
           root_pass: NULL
     architecture_id: NULL
  operatingsystem_id: NULL
      environment_id: NULL
           ptable_id: NULL
           medium_id: NULL
               build: 0
             comment: NULL
                disk: NULL
        installed_at: NULL
            model_id: NULL
        hostgroup_id: NULL
            owner_id: NULL
          owner_type: NULL
             enabled: 1
  puppet_ca_proxy_id: NULL
             managed: 0
           use_image: NULL
          image_file: NULL
                uuid: NULL
 compute_resource_id: NULL
     puppet_proxy_id: NULL
            certname: NULL
            image_id: NULL
     organization_id: NULL
         location_id: NULL
                type: Host::Discovered
                 otp: NULL
            realm_id: NULL
  compute_profile_id: NULL
    provision_method: NULL
           grub_pass:
       global_status: 0
lookup_value_matcher: NULL
   discovery_rule_id: NULL
       salt_proxy_id: NULL
 salt_environment_id: NULL
          pxe_loader: NULL

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to