Guy,

The example you have like..

class showap(
   $amqp_host,
   .....
  )

Pattern is a "parameterized class" pattern. 

it's so you could have a site/node.pp or an ENC provide the 
parameters/values.

node yourserver {

  class { 'showap' : amqp_host => 'TRUE'}

}

or if you wish, hiera will do automagic lookups of class parameters

https://docs.puppetlabs.com/hiera/1/puppet.html#automatic-parameter-lookup

i tend to keep the parameterized class pattern since its fairly portable, 
works with hiera & enc's and once you've seen it, it does't look so scary.. 
  46 parameters is a lot, but not unheard of..

-byron

On Wednesday, December 17, 2014 2:02:24 PM UTC-6, guymatz wrote:
>
> Hi!  I'm taking over someone's code and have found the following class 
> signature - it's been abbreviated considerably; over 46 vars get used!!:
>
> class showapp (
>   $amqp_host,
>   $amqp_password,
>   $amqp_port,
>   $amqp_user,
> .
> .
> .
>
>   $queue_service_host,
>   $queue_service_port,
>   $redis_host,
>   $redis_port,
>   ) 
> It looks like they thought that any hiera vars that were going to be used 
> in the template needed to be defined in the class signature (this isn't 
> right, is it?).
> these vars are defined in hiera and are needed to populate a template 
> defined elsewhere in the class.    I'd rather not have to define every var 
> in my manifest, e.g.:
> $amqp_host = hiera(showapp::amqp_host)
>
> I think I'd rather have a hash defined in hiera that I can pull into my 
> class with one call, e.g.:
> $showapp_data = hiera(showapp)
> then use as a hash, e.g.
> $showapp_data[amqp_host]
>
> Is that the way to go?  Will it work?  Is there a better way?
>
> If you're gotten this far, thank you, thank you, thank you!
>
> Guy 
>
>

-- 
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/368c7156-cbcd-4165-a499-3d4a886e58cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to