Jira (FACT-2869) Puppet 7.0.0 facter changes is_virtual fact to string (from boolean)

22 views
Skip to first unread message

James Ralston (Jira)

unread,
Nov 20, 2020, 12:57:03 AM11/20/20
to puppe...@googlegroups.com
James Ralston created an issue
 
Facter / Bug FACT-2869
Puppet 7.0.0 facter changes is_virtual fact to string (from boolean)
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/11/19 9:56 PM
Priority: Normal Normal
Reporter: James Ralston

In Puppet 6.x, facter reports the is_virtual fact as a boolean:

$ facter --version; facter --json is_virtual
3.14.14 (commit e36657bea27254f003c8fc71d8ef57454db643e2)
{
  "is_virtual": false
}

But in Puppet 7.0.0, facter reports the is_virtual fact as a string:

$ facter --version; facter --json is_virtual
4.0.46
{
  "is_virtual": "false"
}

This is almost certainly a regression, as the 7.0.0 documentation continues to state that the is_virtual fact is a boolean.

This is going to cause major breakage for any code that tests is_virtual as a boolean; e.g.:

if $facts['is_virtual'] {
  # do stuff for VMs
} else {
  # do stuff for physical hosts
}

In the above code, the do stuff for VMs block will always be executed, even for physical hosts, because the boolean evaluation of the String class is true if the length of the string is nonzero and false otherwise, and is_virtual will always have a nonzero length (either "true" or "false").

The easiest work-around for now is to test against the virtual fact instead; e.g.:

if $facts['virtual'] != 'physical' {
  # do stuff for VMs
} else {
  # do stuff for physical hosts
}

But again, this regression is going to burn people who have any code that tests against is_virtual.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Bogdan Irimie (Jira)

unread,
Nov 20, 2020, 9:41:02 AM11/20/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Nov 20, 2020, 9:41:04 AM11/20/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sub-team: ghost
Team: Night's Watch

Bogdan Irimie (Jira)

unread,
Nov 20, 2020, 9:41:04 AM11/20/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Nov 20, 2020, 11:58:03 AM11/20/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Nov 23, 2020, 12:25:03 PM11/23/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Nov 25, 2020, 9:04:05 AM11/25/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost 25.11 , ready for triage 2

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 2:40:05 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost 25.11, ghost-2.12 , ready for triage 2

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 2:45:03 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost 25.11, ghost-2.12, ready for triage ghost- 2 .12

Josh Cooper (Jira)

unread,
Dec 2, 2020, 2:19:04 PM12/2/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 2, 2020, 2:19:04 PM12/2/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Dec 9, 2020, 7:24:04 AM12/9/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages