On Thursday, July 17, 2014 1:27:03 PM UTC-5, Cristian Falcas wrote:
>
> Hi,
>
> I have a "postfix" class with this init:
>
> class postfix (
>   $ensure             = 'latest',
>   $email_user         = undef,
>   $email_pass         = undef,
>   $smtp_endpoint      = "smtp.${::domain}",
>   $smtp_endpoint_port = '25',
>   $from_domain        = $::domain,
>   $from_user          = 'donotreply',
>   $debug              = false) {
>   anchor { 'postfix::begin': }
>   anchor { 'postfix::end': }
>
>   include postfix::install
>   include postfix::config
>   include postfix::service
>
>   Anchor['postfix::begin'] ->
>   Class['postfix::install'] ->
>   Class['postfix::config'] ~>
>   Class['postfix::service'] ->
>   Anchor['postfix::end']
> }
>
>
> And I call it from an other module like this:
>
>   class { 'postfix':
>     email_user         => hiera('email_user', undef),
>     email_pass         => hiera('email_pass', undef),
>     smtp_endpoint      => hiera('email_smtp_endpoint', undef),
>     smtp_endpoint_port => hiera('smtp_endpoint_port', undef),
>     from_domain        => hiera('email_from_domain', undef),
>     from_user          => hiera('email_from_user', undef),
>   }
>
> All parameters that not found in hiera are not initialized with the 
> default values. In the template I use for the config I get only empty 
> values.
>
>

That does look a lot like issue 16221, but I'm uncertain whether it's 
really the same because classes are special, and the way their parameters 
are bound to them is especially special.  I don't know whether what you are 
doing should be expected to work or not.

With that said, you seem to be going to a lot of extra effort here.  
Automated data binding will do exactly what you appear to want if you 
change the hiera keys to suit.  Then you can just do

include 'postfix'

, which is better form for most purposes than the resource-like syntax (see 
the best practices commentary at 
http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html#include-like-vs-resource-like).
  
For that to work, the keys must have form 
<qualified::class::name>::<param_name>, so "postfix::email_user" for 
example.


John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/307ef13f-4070-4587-acea-4e1026e796b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to