On Wednesday, October 31, 2012 7:53:21 AM UTC-5, Trammael wrote: > > Hello, > > I'm trying to send parameters to an Exec ("exec1") based on values, using > a case statement. I've tried putting the two versions of the exec in a > case block, which failed (exec1 is a dependency of exec2, and exec2 > complained it could not find exec1) >
That sounds like a different problem. If some other resource depends on Exec['exec1'], then you must ensure that it is declared. That declaration can certainly be in a case statement, but then you do need to ensure that every case declares a version of the Exec. > , and a case statement can't go directly directly into the parameters of > the Exec itself > No, that's what selectors are for: exec { 'exec1': command => $color ? { blue => '/sbin/aix-foo', silver => '/sbin/osx_foo', red => '/sbin/rhel_foo', default => '/sbin/foo' } } Alternatively, you can assign the parameters to variables inside your case statement, then set the resource parameters via the variable values. > > Google helped me with this thread: > http://comments.gmane.org/gmane.comp.sysutils.puppet.user/20597 > > But I wonder if there is a more modern way of doing it with 2.7.19 (or > 3.0)? > > There is also the alternative of loading the wanted data from an external data source. That's not more "modern", really, as Puppet has had external data facilities for a long time. The community has, however, coalesced around "Hiera" for accessing external data. That was available as far back as Puppet 2.6, I believe, but it was a third-party add-on until its integration into the core in Puppet 3. 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/-/vo5Skcm42moJ. 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.