Hi, I''m using Puppet 3.2.1 and heavily relying on hiera data bindings. I have the following situation: class software ( $my_content = undef, ) { file { ''/path/to/file'': content => $software::my_content, } } in hieradata/software.yaml (hiera.yaml seems ok): software::my_content: template(''mymodule/myfile.erb'') With this configuration I get /path/to/file to contain the string ''template(mymodule/myfile.erb)'' (that is, template() function isn''t evaluated). Is this a normal behaviour? Of course if I declare my class with: class { ''software'': my_content => template(''mymodule/myfile.erb'') } everything works fine. If I use the ''source'' attribute instead of ''content'', I can write in hiera: software::my_source: puppet:///modules/mymodule/myfile.conf and it works as expected. Must I intend that this is something related just to functions in hiera? Thanks, Fabio -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Tuesday, June 11, 2013 10:28:51 AM UTC-5, Fabio Sangiovanni wrote:> > Hi, > > I''m using Puppet 3.2.1 and heavily relying on hiera data bindings. > I have the following situation: > > class software ( > $my_content = undef, > ) { > file { ''/path/to/file'': > content => $software::my_content, > } > } > > in hieradata/software.yaml (hiera.yaml seems ok): > software::my_content: template(''mymodule/myfile.erb'') > > With this configuration I get /path/to/file to contain the string > ''template(mymodule/myfile.erb)'' (that is, template() function isn''t > evaluated). > Is this a normal behaviour? > >Yes, anything that comes in from hiera is just a string - function calls in it won''t get evaluated. If you remove the template() part from the hiera data and change your code to: class ($my_content = undef, { ''software'': my_content => template($my_content) } it should give you the ability to have the data in hiera and still use the template function.> Of course if I declare my class with: > class { ''software'': my_content => template(''mymodule/myfile.erb'') } > everything works fine. > > If I use the ''source'' attribute instead of ''content'', I can write in hiera: > software::my_source: puppet:///modules/mymodule/myfile.conf > and it works as expected. > > Must I intend that this is something related just to functions in hiera? > > Thanks, > Fabio >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Fabio Sangiovanni
2013-Jun-11 18:48 UTC
Re: [Puppet Users] Re: hiera data bindings and template()
Il giorno 11/giu/2013 18:14, "llowder" <llowderiv@gmail.com> ha scritto:> Yes, anything that comes in from hiera is just a string - function callsin it won''t get evaluated.> If you remove the template() part from the hiera data and change yourcode to:> > class ($my_content = undef, { ''software'': my_content =>template($my_content) }> > it should give you the ability to have the data in hiera and still usethe template function. Hi, thanks for the clarification! I''ll change my module to embed the template() call and rely on hiera for the path to the erb file only. -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.