On Monday, January 14, 2013 11:00:42 AM UTC-6, Eric Sakowski wrote:
>
>
> [...]
> OK, so given that I am a user of the apache module, and it is 
> parameterized already when I install it, for Puppet 3.0 then I could simply 
> drop create_resources call and Puppet 3 will automatically look it up in 
> hiera?  
>


That is correct.  Just use this:

include 'apache'

In addition, you will need to structure your hiera data slightly 
differently.  Instead of collecting the class parameters in a hash, they 
need to be (namespaced) top-level data:

apache::default_mods :         true
apache::default_vhost :        false
apache::default_ssl_vhost :    false
apache::service_enable :       true
apache::serveradmin :          'root@localhost'
apache::sendfile :             false
apache::error_pages :          false

Note that the namespace prefix is just part of the keys as far as hiera is 
concerned; the magic happens on the Puppet side.

 

> [...]
> OK.  Sounds like having my defaults come from the apache modules parameter 
> declarations may be a problem in Puppet 3.0.



Not at all.  Puppet will fall back to the default (if any) in the class 
definition if hiera does not provide a value for a given parameter.  The 
precedence is:  explicit parameters in your class declaration (do not use) 
> parameters read from hiera > parameters in the class definition > undef.  
Puppet uses the first one found, on a parameter-by-parameter basis.

 

>   I am installing a Puppet 3 master to try and test this.  Any suggestions 
> on how best to set up the error condition you describe?  I have run across 
> some error messages from puppet rdoc finding multiple class declarations.  
> I'd like to better understand what you're talking about here -- I'll go 
> google but any links would be appreciated!
>


A simple, but very synthetic test case would be:

node test {
  include 'apache'
  class { 'apache': service_enable => true }
}

where you test with a node 'test'.  Replace the "class ..." line with your 
create_resources() call to test that flavor.  Note also that order matters: 
if you swap the "include" and "class" lines then it should work.  On the 
other hand, it should not work if you change the "include" line to a copy 
of the "class" line: multiple parametrized-style declarations of the same 
classes are not forbidden even when the parameter lists match (except maybe 
where no parameters are explicitly declared at all).

 

>
> That sounds great and probably what I will do when we eventually upgrade 
> to Puppet 3.  Basically just drop the calls to create_resources  and simply 
> include.
>
>

Yes, that is precisely my recommendation.


Best,

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/-/fqQc_soJ34EJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to