How to reference nested array in facter 3.6.8 (and what happened to $::vlans) ?

asked 2018-01-03 10:50:22 -0600

mehh gravatar image

Within a manifest, with facter 2.4.6 I was able to reference ipaddrs of VLAN interfaces with $ipaddress_enp0s8_25. Now with facter 3.6.8 I'm having trouble finding the proper convention. As shown below, I can see the address is nested in an array (bindings) but I can't figure out how to access it.

And related, I can access facts with the convention facter networking.domain returns 'local', yet $facts['networking']['domain'] returns all the facts.

I'm not finding the available documentation, nor anything from extensive search results to clarify this.

# facter 
[ ... ]
networking => {
  domain => "local",
  fqdn => "smar02.local",
  hostname => "smar02",
  interfaces => {
    enp0s3 => {
      bindings => [
        {
          address => "10.0.2.15",
          netmask => "255.255.255.0",
          network => "10.0.2.0"
        }
      ],
      dhcp => "10.0.2.2",
      ip => "10.0.2.15",
      mac => "08:00:27:7c:ca:43",
      mtu => 1500,
      netmask => "255.255.255.0",
      network => "10.0.2.0"
    },
    enp0s8 => {
      mac => "08:00:27:1f:2c:1f",
      mtu => 1500
    },
    enp0s8.25 => {
      bindings => [
        {
          address => "192.168.25.74",
          netmask => "255.255.255.0",
          network => "192.168.25.0"
        }
      ],

[ ... ]

Some other items of confusion:

facter 2.4.6: $ipaddress gives the value "10.0.2.15" 
facter 3.6.8: $ipaddress gives the value "192.168.25.74" 

facter 2.46: $vlans gives the value "25" 
facter 3.6.8: $vlans returns nothing
edit retag flag offensive close merge delete