On May 3, 2010, at 7:22 AM, Daniel Pittman wrote:
> G''day.
>
> I have a problem. Mostly a theoretical problem, granted, but a
> problem:
>
> We have machines with a variety of hardware RAID controllers, and
> some that
> don''t have one at all. We want these monitored, which usually
> involves some
> vendor-specific binary blob, plus support code, installed and running.
>
> Supporting *a* RAID controller isn''t too hard; I have a fact that
> pulls that
> out and lets me install the right support.
>
> In the event we got two RAID controllers in a single machine (or,
> theoretically, I run into this elsewhere), how would I best go about
> this?
>
> As far as I can tell, this doesn''t work; it matches nothing, ever:
>
> $test = [''one'', ''two'']
> case $test {
> ''one'': { ... }
> ''two'': { ... }
> }
>
> So, how can I make decisions about the content of that array?
>
> My best guess, right now, is that I would need to use a define, then
> expand
> that using the array as the name, and have the content perform the
> case
> statement to include the appropriate class. Ick.
>
> define what_a_nasty_hack () {
> case $name {
> ''one'': { ... }
> ''two'': { ... }
> }
> }
>
> what_a_nasty_hack { $test: }
>
>
> Anyway, is there a better way to handle this that I can''t see
right
> now, or is
> this perhaps something that the language could stand enhancing?
It probably is a deserved language enhancement, but in the short term
a function is your best bet.
--
Getting caught is the mother of invention. --Robert Byrne
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.