So I can't use a hash? I'm trying to make a general use parameterized
class using a profile . . . Can I do something like this so I only have to
pass in the service name that I want to configure from my node definition:
class profiles::dropwizard (
$dw_service = 'dw_service_UNDEFINED',
$amqp_host = hiera($dw_service::amqp_host)
)
than my role would be:
class roles::showroom inherits roles::base {
class { profiles::dropwizard:
dw_service => 'showroom',
}
}
Hiera isn't able to find the above, and i've tried with varying curly
braces. Sorry if this is getting convoluted & out of scope.
On Wed, Dec 17, 2014 at 3:56 PM, Byron Miller <[email protected]> wrote:
>
> 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
> <https://groups.google.com/d/msgid/puppet-users/368c7156-cbcd-4165-a499-3d4a886e58cc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CABnTgtUK-r5jKoAU6v0Wx2WuFKa8GjcYiT1raF3WROpV7e80qw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.