> so, one specific example,
>> someone (not me) implemented a class tomcat with parameters port and
>> ssl_port.
>> I want to use that class,
>> and I want that the ssl_port is always port + 1 (I don't want this to be
>> configurable in hiera)
>>
> so, in my hiera data, I will specify port, and then I have my class:
>>
>
>> class application ($port) {
>> class {tomcat:
>> port => $port
>> ssl_port => $port+1
>> }
>> class {nginx:
>> ...
>> }
>> # configuration files...
>> }
>>
>> how would you do this without using resource-like class declaration?
>>
>
> At the present time, I think I would need to write a custom hiera back end
> that served keys 'tomcat::port' and 'tomcat::ssl_port' with values having
> the desired relationship, and to insert that into my hiera configuration at
> higher priority than the YAML back end. The class 'application' then
> declares class 'tomcat' as "include 'tomcat'". Really, though, that's a
> heck of a PITA for such a small constraint. Why not just declare both
> parameters in the normal YAML back end, and verify the proper ports via
> functional testing?
>
that's the point. I don't think this is a "small" constraint. I often find
this dependency injection use case,
and I don't see an easy solution with puppet.
> But you could do this:
>
> class parameters ($port) {
> $ssl_port = $port +1
> }
>
>
>> class tomcat {
>> include parameters
>> notice $parameters::port
>> notice $parameters::ssl_port
>> }
>>
>
> And then the rest of class 'tomcat' uses $parameters::port and
> $parameters::ssl_port for the HTTP and HTTPS ports? Ok, but that requires
> you to modify the 'tomcat' class. If you're willing to do that, then why
> introduce a new class as a data intermediary?
>
I wrote that just to see if I understood your point. Yes, I cannot modify
the 'tomcat' class, so this option is not possible.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/706dc2b2-7844-4c1e-ac55-9ce5ed31cbaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.