Page MenuHomePhabricator

custom fact interface_primary breaks under newer versions of facter
Closed, ResolvedPublic

Description

Under facter 3.5.1, which is included with the puppetlabs "collection" puppet-agent package that provides puppet 4.8.2 for Ubuntu Trusty, our ipaddress custom fact breaks with error:

ERROR puppetlabs.facter - error while resolving custom fact "ipaddress": no implicit conversion of nil into String

Event Timeline

herron triaged this task as Medium priority.Dec 13 2017, 8:18 PM
herron created this task.

It looks like the regex in interface_primary expects trailing whitespace from the command output but leading/trailing whitespace is being stripped away under the newer version of facter.

gw_route = Facter::Util::Resolution.exec('ip -4 route list 0/0')
/.* dev (?<intf>[^\s]+) .*/ =~ gw_route

Changing this to /.* dev (?<intf>[^\s]+) ?$/ =~ gw_route fixes this, but will need to verify this won't introduce problems elsewhere.

Change 398120 had a related patch set uploaded (by Herron; owner: Herron):
[operations/puppet@production] facter: fix interface_primary under newer versions of facter

https://gerrit.wikimedia.org/r/398120

Facter 3 is quite different than Facter 2, and we're not ready to use this -- that would be a transition of its own, I think. For what it's worth, it also ships with a structured fact, networking[primary] (if memory serves), that does effectively the same as interface_primary.

We also should not be using puppetlabs' packages -- they're very different than Debian's, and also pretty horrible, shipping Ruby themselves, putting everything into /opt etc. Just backport Debian/Ubuntu's package to trusty.

herron lowered the priority of this task from Medium to Low.Dec 18 2017, 7:07 PM

Change 398120 had a related patch set uploaded (by Jbond; owner: Herron):
[operations/puppet@production] facter: fix interface_primary under newer versions of facter

https://gerrit.wikimedia.org/r/398120

Change 398120 merged by Jbond:
[operations/puppet@production] facter: fix interface_primary under newer versions of facter

https://gerrit.wikimedia.org/r/398120

We can close this, given that the patch by @jbond was merged, right?