Hiera Array Only Returns Last Line

6 views
Skip to first unread message

Dan Crisp

unread,
Feb 29, 2020, 1:42:19 PM2/29/20
to Puppet Users
Hi,

Attempting to popualte a file with a hiera array.  

I have the following hiera defined:

# more common.yaml
vimrc:
  - 'syntax on'
  - 'colo delek'
  - 'set nu'
  - 'set cursorline'
  - 'set history=1000'
  - 'set showmode'
  - 'set showcmd'

Puppet lookup seems to return what I expect to see:

# puppet lookup vimrc
---
- syntax on
- colo delek
- set nu
- set cursorline
- set history=1000
- set showmode
- set showcmd

Here's how I'm call the hiera array:

class base::vim {

  $set = lookup('vimrc', Array[String])

  package { 'vim': ensure => installed, }

  file { '/root/.vimrc':
    owner    => root,
    group    => root,
    mode     => '0644',
    content  => $set,
  }

}

However I just end up with the last line of the arrary:

# more .vimrc
set showcmd

Any help here would be greatly appreciated.

Thanks,
Dan.

Martin Alfke

unread,
Feb 29, 2020, 2:44:38 PM2/29/20
to puppet...@googlegroups.com
AFAIK content expects a string.
Maybe you can try

content => $set.flatten

hth,
martin
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3620a92d-f2d2-43a4-9f92-4d12c3f0c45f%40googlegroups.com.

Dan Crisp

unread,
Feb 29, 2020, 2:56:32 PM2/29/20
to Puppet Users
Thanks for the respone Martin.  Unfortunately that made no difference.  Still only end up with one line.

Thanks,
Dan.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet...@googlegroups.com.

Martin Alfke

unread,
Feb 29, 2020, 3:49:04 PM2/29/20
to puppet...@googlegroups.com
Sorry. wrong function:

content => $set.join("\n")

hth,
martin
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d30de2a4-a70b-41df-a9d3-f65001498be7%40googlegroups.com.

Dan Crisp

unread,
Mar 1, 2020, 9:55:22 AM3/1/20
to Puppet Users
Perfect!!!  Thank you Martin.
Reply all
Reply to author
Forward
0 new messages