Hi Nan, Thanks for the answer - I'm not 100% clear how I could acheive this, could you expand on your suggestion a little, perhaps with an example? Would the file resource point at the .gz file in the module? If so how would I then reference the file resource in the tar command?
Many thanks, Edd On May 2, 4:15 pm, Nan Liu <n...@puppetlabs.com> wrote: > Use a file resource to deploy it to the agent and make the exec depend > on the file resource. > > On May 2, 2011, at 7:58, Edd Grant <e...@eddgrant.com> wrote: > > > > > > > > > Hi All, > > > I have defined the following module to untar/unzip and copy the Maven > > distributable to a convenient location: > > > class apache-maven-v3 { > > exec { "/bin/tar xzf /etc/puppet/modules/apache-maven-v3/files/ > > apache-maven-3.0.3-bin.tar.gz": > > cwd => "/usr/local/java", > > creates => "/usr/local/java/apache-maven-3.0.3", > > } > > ... > > } > > > The above definition executes perfectly however in order to keep the > > module portable I want to replace the absolute path to the .gz file > > with a puppet:/// URI e.g. > > > exec { "/bin/tar xzf > > puppet:///modules/apache-maven-v3/apache-maven-3.0.3-bin.tar.gz": > > > When I change the class to use the puppet:/// URI I get the following > > error: > > > (/Stage[main]/Apache-maven-v3/Exec[/bin > > /tar xzf > > puppet:///modules/apache-maven-v3/apache-maven-3.0.3-bin.tar.gz]/return > > s) change from notrun to 0 failed: /bin/tar xzf > > puppet:///modules/apache-maven-v > > 3/apache-maven-3.0.3-bin.tar.gz returned 2 instead of one of [0] at / > > etc/puppet/ > > modules/apache-maven-v3/manifests/init.pp:11 > > > It appears to me that the puppet:/// URI is not being resolved in the > > exec and this is causing the tar command to operate on the literal > > path puppet:///modules/apache-maven-v3/apache-maven-3.0.3-bin.tar.gz > > which of course doesn't exist. > > > Looking at the docs I can't see any examples of puppet:/// being used > > in this way, is there anyway I can obtain the resolved absolute path > > to pass this in to my exec? Failing that it there a standard approach > > for combining a puppet:/// URI with an exec? > > > Cheers, > > > Edd > > > -- > > 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 > > athttp://groups.google.com/group/puppet-users?hl=en. -- 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.