Hammer discovery auto-provision

Problem:
discovery lists the host, but no rules found until 10-20 seconds later:

[root@foreman ~]# hammer discovery list
---|------|-----|------|--------|------------|------------|--------|------------
ID | NAME | MAC | CPUS | MEMORY | DISK COUNT | DISKS SIZE | SUBNET | LAST REPORT
---|------|-----|------|--------|------------|------------|--------|------------
[root@foreman ~]# hammer discovery list
----|-----------------|-------------------|------|--------|------------|------------|-------------------------|--------------------
ID  | NAME            | MAC               | CPUS | MEMORY | DISK COUNT | DISKS SIZE | SUBNET                  | LAST REPORT        
----|-----------------|-------------------|------|--------|------------|------------|-------------------------|--------------------
478 | macd0946619f150 | d0:94:66:19:f1:50 | 2    | 64315  | 1          | 114474     | provision (10.1.0.0/16) | 2018/04/08 18:02:30
----|-----------------|-------------------|------|--------|------------|------------|-------------------------|--------------------
[root@foreman ~]# hammer discovery auto-provision --id 478
Could not create the host:
  No rule found for host macd0946619f150
[root@foreman ~]# hammer discovery auto-provision --id 478
Could not create the host:
  No rule found for host macd0946619f150
[root@foreman ~]# hammer discovery auto-provision --id 478
Could not create the host:
  No rule found for host macd0946619f150
[root@foreman ~]# hammer discovery auto-provision --id 478
Host created
[root@foreman ~]# 

Expected outcome:

Once the host is seen by discovery, it should be eligible for auto-provision

Foreman and Proxy versions:
1.15.6

|katello|Content and Subscription Management plugin for Foreman|N/A|3.4.5|

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]

Hello, interesting bug indeed :slight_smile:

Can you show us your rules - particularly search conditions.

Then I’d be interested in grabbing facts right after you discover a host and then before you provision it via rules. Nodes reupload facts after every 30 seconds or minute (can’t remember), maybe there is something which changes overtime that makes your rule to trigger. Ideally make a diff of these facts to see the difference.

Thanks.

I’ve sort of modified the facts scrpt for lldp in the discovery image.
my discovery rule

@foreman ~]# hammer discovery-rule info --id 1
ID:                1
Name:              compute
Priority:          0
Search:            facts.lldp_neighbor_sysdesc_em3 ~ compute
Host Group:        compute hosts/compute hosts infiniband
Hosts Limit:       0
Enabled:           true
Hostname template: <%= @host.facts['lldp_neighbor_sysdesc_em3']%>-<%= @host.facts['lldp_neighbor_portid_em3']%>

interestingly enough, if I do “refresh facts” all the lldp info disappear

I have the info gathered in:

/root/install/foreman-discovery-image/root/usr/share/fdi/facts/openlldp.rb

do I need to copy this somwhere into the facts checker for the puppet client as well?

I upgraded to katello 3.5 today, and the issu is still there.

Interesting, okay. How did you “modified the facts script”? Is that a runtime extension? That could be a bug.

Automatic discovery sends are triggered via systemd service while if you do explicit refresh it’s actually facter module from smart proxy, so these are two different code paths.

Ok.

bear with me. I know extremely little about both foreman and puppet and facter. I use this mainly to provision a hpc cluster

So. the facter script for the smart proxy. Where do I find that?

Ok, FDI image version? Can you try with 3.4.4? Other than that it’s a bug.

Thank you I will upgrade the fdi image