On Wednesday, May 14, 2014 4:20:08 AM UTC-5, Felix.Frank wrote:
>
> On 05/06/2014 06:04 PM, Marcin wrote: 
> > I use exec of course – sample of this is below: 
> > 
> >     exec { " something _${name}": 
> > 
> >       command => $some_command_here, 
> > 
> >       require => something [$order], 
> > 
> >       creates => some entry here 
> > 
> >     } 
> > 
> >   
> > 
> > but what do I need to put in Hiera file, on the FIRST hash – where the 
> > question marks are in my example? 
> > 
>
> Hi, 
>
> use an empty string and build this slightly differently: 
>
> exec { " something _${name}": 
>       command => $some_command_here, 
>       creates => some entry here 
> } 
> if something[$order] { 
>   Exec["something_${name}"] { require => something [$order] } 
> } 
>
>

Or if you want to put it all in one resource block,

exec { " something _${name}": 
      command => $some_command_here, 
      creates => some entry here,
      require => $something[$order] ? {
          '' => undef,
          default => Exec["something_${something[$order]}"]
      }
} 

That better satisfies my distaste for overrides.  In fact, if I didn't want 
to use a selector as above then I would use a chain expression instead of a 
resource override:

(alternative:)
if something[$order] { 
  Exec["something_${something[$order]}"] -> Exec["something_${name}"]
} 

 

> But I've got to add - this design feels very hacky. Are you sure you 
> want to do things this way? It will be horrible to maintain. 
>
>

+1
 

If you can explain the whole problem you are solving, someone may have a 
> suggestion on how to design the solution in a more straight-forward 
> fashion. 
>
>

We're all ears.


John
 

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b627465f-c0a9-45c3-bb72-446363c39972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to