Missing fact is_virtual after upgrading to puppet 4.10.9 on foreman 1.15.6 for physical servers (is_virtual=false)


Yesterday i updated a client from puppet 3.8.7 to puppet 4.10.9 and is_virtual fact is no more available. The client is a physical server, so i’m expecting to have reported is_virtual=false. For a virtual machine, instead, with the same puppet version, is_virtual=true fact exists.

If i run facter -p is_virtual on both hosts i get false on the first, and true on the latter. But if i search in the facts for the physical server, is_virtual is not available as fact. This break some reports and some scripts we’re using to extract the list of the physical machines.

Expected outcome:

Have is_virtual fact available also when false.

Foreman and Proxy versions:

  • foreman-1.15.6-1.el7.noarch
  • foreman-proxy-1.15.6-1.el7.noarch
  • puppetserver-2.8.1-1.el7.noarch

Foreman and Proxy plugin versions:

Other relevant data:

puppet agent -t -ddd | grep is_virtual

Debug: Facter: fact “is_virtual” has resolved to false.

I implemented a workaround for using the virtual=physical fact, but is not what i’m looking because splits the set in more than two groups (physical and virtual) creating n+1 groups where n is the number of virtualization platforms (vmware, kvm, xen).

While looking through the code for an unrelated update I found why. In Puppet 3 all facts are strings but in Puppet 4 it’s proper booleans. That means this code fails:

Should be fixed by https://github.com/theforeman/foreman/pull/6253

Ignore me, may still not be fixed by the linked patch. That only assured, we’re not dropping false facts.