Hi, I''m having an issue trying to pass an array parameter for a hiera lookup hiera.yaml: :hierarchy: - some_place/%{hostnames} dummy_host.yaml: --- host: ''dummy_host'' instances: dummy01:1.2.3.4 dummy02:1.2.3.4 dummy03:1.2.3.4 in my manifest I have: $hostnames = [ ''dummy_host'', ''dummy_host1'' ] $hiera_lookup = hiera(''instances'') The above results in me getting the following error: can''t convert Array into String at manifest.pp:18 on node hostname I also tried using hiera_array and hiera_hash without success. Thank you for your help Mike -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/9bffZQjQ190J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
FYI, if I replace $hostnames = [ ''dummy_host'', ''dummy_host1'' ] by $hostnames = ''dummy_host'' this works. On Friday, November 23, 2012 12:19:11 PM UTC-5, mickael avedissian wrote:> > Hi, > > I''m having an issue trying to pass an array parameter for a hiera lookup > > hiera.yaml: > :hierarchy: > - some_place/%{hostnames} > > dummy_host.yaml: > --- > host: ''dummy_host'' > instances: > dummy01:1.2.3.4 > dummy02:1.2.3.4 > dummy03:1.2.3.4 > > > in my manifest I have: > $hostnames = [ ''dummy_host'', ''dummy_host1'' ] > $hiera_lookup = hiera(''instances'') > > > The above results in me getting the following error: > can''t convert Array into String at manifest.pp:18 on node hostname > > > I also tried using hiera_array and hiera_hash without success. > > Thank you for your help > Mike >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/jkGKvIGafmkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I think you need to user "hiera_array" rather than hiera_lookup -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/5k-m908vuFgJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Friday, November 23, 2012 11:19:11 AM UTC-6, mickael avedissian wrote:> > Hi, > > I''m having an issue trying to pass an array parameter for a hiera lookup > > hiera.yaml: > :hierarchy: > - some_place/%{hostnames} > > dummy_host.yaml: > --- > host: ''dummy_host'' > instances: > dummy01:1.2.3.4 > dummy02:1.2.3.4 > dummy03:1.2.3.4 > > > in my manifest I have: > $hostnames = [ ''dummy_host'', ''dummy_host1'' ] > $hiera_lookup = hiera(''instances'') > > > The above results in me getting the following error: > can''t convert Array into String at manifest.pp:18 on node hostname > > > I also tried using hiera_array and hiera_hash without success. > >Hiera does not provide the feature you are looking for. Each element of the hierarchy array in hiera.yaml identifies *one* data source. You cannot expand a single element into multiple elements by interpolating an array. I think you are heading in the wrong direction by attempting to manipulate your data hierarchy. Play all the games you want with your data, but approach your hierarchy with great care. In this particular case, it appears that you want to perform a UNION query of some of your hiera data. I can''t think of a good way to do that in core Puppet, but it should be straightforward to write a custom function for it. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/KdJp7ZPLDsQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.