Ask Your Question
0

Hiera Array not returning all items

asked 2017-06-23 04:03:25 -0600

We're having a few issues with using hiera_array to bulk install a list of packages from Hiera data. We have defined a list of support packages we need installing at the common, os and sometimes the node level, recently we've seen that only the items on the top most level get installed. I'm completely lost on what would be causing this, and I'm hoping someone can point out something I've missed.

  • Puppet Agent 4.10.4
  • Puppet Server 2.7.2

Here is the snippets we're using:

base.pp

# Support packages
$support_packages = hiera_array('mds::support_packages')

package { $support_packages: ensure => 'installed', }

hiera.yaml

---
:backends:
  - yaml

:hierarchy:
  - "node/%{::fqdn}"
  - "vlan/%{vlan}"
  - "customer/%{customer}"
  - "network/%{network_env}"
  - "os/%{::osfamily}/%{::operatingsystem}/%{::operatingsystemrelease}"
  - "os/%{::osfamily}/%{::operatingsystem}/%{::operatingsystemmajrelease}"
  - "os/%{::osfamily}/%{::operatingsystem}"
  - "os/%{::osfamily}"
  - "common"

:yaml:
  :datadir: "/etc/puppet/environments/%{::environment}/hieradata"

:merge_behavior: deeper

common.yaml

mds::support_packages:
    - lsof
    - strace
    - sysstat
    - tcpdump
    - nfs-utils
    - mlocate
    - parted
    - wget
    - telnet
    - unzip
    - zip
    - nano
    - dos2unix
    - mutt
    - p7zip
    - sharutils
    - net-tools
    - eject
    - time

os/RedHat/RedHat/7.yaml

mds::support_packages:
    - nmap-ncat
    - tmux
    - compat-libstdc++-33

Target system state.yaml

[root@xxxxxx state]# grep Package state.yaml
<snip>
Package[nmap-ncat]:
Package[tmux]:
Package[compat-libstdc++-33]:
<snip>

Output of a hiera CLI call

[root@puppet ~]# hiera -c /etc/puppetlabs/puppet/hiera.yaml -a mds::support_packages environment=production ::fqdn=xxxx ::osfamily=RedHat ::operatingsystem=RedHat ::operatingsystemmajrelease=7
["nmap-ncat",
 "tmux",
 "compat-libstdc++-33",
 "psmisc",
 "coreutils",
 "bind-utils",
 "lsof",
 "strace",
 "sysstat",
 "tcpdump",
 "nfs-utils",
 "mlocate",
 "parted",
 "wget",
 "telnet",
 "unzip",
 "zip",
 "nano",
 "dos2unix",
 "mutt",
 "p7zip",
 "sharutils",
 "eject",
 "time"]
edit retag flag offensive close merge delete

Comments

1

Recommend using lookup instead of hiera_array, and using the lookup CLI instead of the hiera one. Also note that deep merge in hiera 3 only applies to hashes.

Henrik Lindberg gravatar imageHenrik Lindberg ( 2017-06-26 06:34:14 -0600 )edit

Thanks Henrik, ```puppet lookup``` returns its own stack of errors (which I'm yet to get to the bottom of), but it does seem to relate to a change introduced after Puppet 4.8.

nikdoof gravatar imagenikdoof ( 2017-06-26 06:57:59 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-26 06:56:18 -0600

After much investigation it seems like its a bug/issue introduced after Puppet 4.8. Downgrading my master to 4.8.3 agent resolves the issue. It seems to be related to PUP-7286.

For the moment the workaround of rolling the master's agent back works, but in the near future we're looking at migrating all depreciated hiera_xxx calls to lookup

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-23 04:02:25 -0600

Seen: 107 times

Last updated: Jun 26