Scott,
I'd keep it DRY and use a definition.  In fact, I use definitions for all exec 
calls.
Here's an example that I use for wget for tar based installs.
Change it to class cmd and definition of make (cmd::make) and you are good to 
go.


===============================================================
class download_files {

     define with_wget ($url,$dest,$user)
        {
           exec {
                  $name:
                  command => "/usr/bin/wget ${url}/${name}",
                  cwd     => $dest,
                  creates => "${cwd}/$name",
                  user    => $user,
                  require => Class["install_wget"]
                }
        }
}
===============================================================
class  buildbox_step1 {
             
     $filelist = 
["jdk1.6.0_16.tar","apache-tomcat-6.0.20.tar.gz","anthill3-3.7.0_50742.tar.gz"]
             
          download_files::with_wget {
              $filelist:
               url      => "http://puppet.lab/puppet";,
               dest     => "$download_dir",
               user     => "root",
               before   => Class[buildbox_step2]
           }
  }


A little obtuse up front, but I'm not cutting and pasting the same exec code 
all over the place and don't have to worry about name uniqueness.
Ted


-----Original Message-----
From: puppet-users@googlegroups.com [mailto:puppet-us...@googlegroups.com] On 
Behalf Of Scott
Sent: Thursday, October 08, 2009 6:52 PM
To: Puppet Users
Subject: [Puppet Users] Re: Same exec but different working directories


Nigel, thanks!  I tried something similar more than a year ago that
didn't work so it didn't occur to me to try that.

Scott


On Oct 8, 5:52 pm, Nigel Kersten <nig...@google.com> wrote:
> On Thu, Oct 8, 2009 at 2:36 PM, Scott <scott...@gmail.com> wrote:
>
> > So I ran into a situation where I'd like to execute the same command
> > (make) but in 2 different working directories, anyone know how I can
> > do that without adding superfluous options to the exec to make it
> > unique?
>
> exec { "foo":
>   command => "make blah",
>   cwd => "/foo",
>
> }
>
> exec { "foo_two":
>   command => "make blah",
>   cwd => /foo_two",
>
> }
>
> is that what you mean?


--~--~---------~--~----~------------~-------~--~----~
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