[Puppet Users] Re: execute more commands (beginner talking)

Reno
Wed, 21 Oct 2009 17:16:36 -0000

opssss sorry I didn''t see too! :-)

Btw

onlyif => "/usr/bin/apt-get -q -q update"

say  to do that just after the apt-get command is lunched  but what if
I want the contrary ... to run the command only if the apt-get fail to
run?



On Oct 21, 6:02 pm, Roy Nielsen <r...@lanl.gov>
wrote:
> oops, quote in the wrong place, try:
>
> exec { "touch /home/ciao":
>       cwd => "/home",
>       path => "/usr/bin:/usr/sbin:/bin",
>       onlyif => "/usr/bin/apt-get -q -q update"
>
> }
> Reno wrote:
> > err: Could not retrieve catalog: Could not parse for environment
> > production: Syntax error at ''cwd''; expected
''}'' at /etc/puppet/
> > manifests/classes/source.list.pp:24
>
> > On Oct 21, 5:45 pm, Roy Nielsen <r...@lanl.gov> wrote:
> >> Use the onlyif parameter of the exec type:
>
> >> exec { "touch /home/ciao:"
> >>      cwd => "/home",
> >>      path => "/usr/bin:/usr/sbin:/bin",
> >>      onlyif => "/usr/bin/apt-get -q -q update"
>
> >> }
>
> >> Note: the onlyif parameter only works this way with the
> >> "exec" type (works a bit differently for the augeas
type)
> >> The unless parameter only works with exec at this point.
>
> >> Regards,
> >> -Roy
>
> >> Reno wrote:
> >>> Yes I agree,
> >>> for example what you will do if I want to run the touch
command only
> >>> if /usr/bin/apt-get -q -q update has run without error?
> >>>  exec { subscribe-echo:
> >>>                command     => "/usr/bin/apt-get -q -q
update",
> >>>                logoutput   => false,
> >>>                refreshonly => true,
> >>>                subscribe   =>
file["/etc/apt/sources.list"]
> >>>        }
> >>>  exec { "touch /home/ciao":
> >>>     cwd => "/home",
> >>>     path => "/usr/bin:/usr/sbin:/bin"
> >>> }
> >>> On Oct 21, 4:56 pm, Brice Figureau
<brice-pup...@daysofwonder.com>
> >>> wrote:
> >>>> On Wed, 2009-10-21 at 08:53 -0700, Reno wrote:
> >>>>> hi and thanks for the help
> >>>>> I use a more simple ( to me ) but effective solution:
> >>>>>  exec { "touch /home/ciao":
> >>>>>     cwd => "/home",
> >>>>>     path => "/usr/bin:/usr/sbin:/bin"
> >>>>> }
> >>>> You can''t guarantee this exec won''t run
_before_ your other exec if you
> >>>> don''t add strict ordering metaparameters
(require/before).
> >>>> --
> >>>> Brice Figureau
> >>>> Follow the latest Puppet Community evolutions
onwww.planetpuppet.org!