On Jun 18, 1:35 pm, vagn scott <vagnsc...@gmail.com> wrote:
> On 06/18/2011 10:31 AM, Markus Falb wrote:
>
>
>
> > On 18.6.2011 05:30, vagn scott wrote:
>
> >> or you can do what I do and pipe that archive into tar:
>
> >>          exec { "true $title&&  wget -O - $upstream | tar xzf - --xform
> >> 's,wordpress/,,'":
> >>                  cwd         =>  "$top",
> >>                  creates     =>  "$top/license.txt",
> >>                  before      =>  File[ "$top/setup.mysql" ],
> >>          }
>
> >> the reason for the 'true $title&&' part is
> >> that I want to be able to use this exec multiple times (it is in a
> >> defined class).
> >> So I need to get the $title in there so puppet doesn't think it is
> >> a duplicate definition.
>
> > You can separate the title from the actual command
>
> > exec { "uniqe title maybe with $title in it":
> >    command =>  "wget...",
> >    ...
> > }
>
> And then I have to make up a title that won't collide
> with another title somewhere else. Also, I lose a line
> of vertical space on the screen, and I have to go
> looking for what the exec is doing, instead of it being
> on the first line.   Shortcut operators don't slow me
> down at all.  Those are my tradeoffs, and why
> I chose this style.  YMMV.
>
> But, since you mentioned it: Is it so arcane a practice that
> I should avoid it for the sake of people reading my code?


If your concern is for the people reading your code then yes, you
should give your Execs a plain-language title.  You might even find
that "people reading your code" includes you, six months from now.  Or
tomorrow.  The readability advantage compounds with the number of
Execs in your manifests and with the complexity of their commands.

There are advantages other than readability, as well.  In particular,
the resource title does not change when you tweak the command.  This
is important if your manifests refer to the Exec resource by title --
in another resource's "before" or "notify" parameter, for instance.


John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to