Adding this parameter to your file resource,
notify => Exec['Deploy Code'],
and these parameters to your exec resource,
require => File['/var/tmp/deploy.tar'],
refreshonly => true,
will create the appropriate dependency. Basically, it makes sure the file
resource must run before the exec. Puppet manifests do not run in a top down
manner, do it's important to specify the order of resouces when necessary.
--
Peter
On Aug 9, 2012, at 4:51 AM, duckegg01 <[email protected]> wrote:
> Hi Peter
>
> I managed to get this working by have the cwd in place, but im interested in
> your point with regards to setting up the dependency any chance you can
> provide an example of this based on what I have at present.
>
> On Wednesday, August 8, 2012 5:29:06 PM UTC+1, pmbuko wrote:
> On Aug 8, 2012, at 5:40 AM, duckegg01 wrote:
>
> > Hi
> >
> > I have wriiten a class to deploy a tra file and extract on a remote puppet
> > client. The tar file gets copied across fine and it seems to puppet the
> > thet tar extraction suceeds, but when I check the client I dont see the
> > extracted files
> >
> > exec { "Deploy Code":
> > command => "/bin/tar -xvf /var/tmp/deploy.tar",
> > onlyif => [
> > "/usr/bin/test -d /var/tmp/test/" #just
> > testing this
> > ]
> > }
>
> I see two possible issues. First, you either need to give the exec resource a
> working directory via the 'cwd' parameter, or you need to use tar's -C option
> to specify where to extract the files. Without either of these, files will
> extract into the home of whichever user is running puppet. So either add this
> parameter:
>
> cwd => '/var/tmp/,
>
> or use this as your tar command ( -- # note that I skipped the verbose switch
> since it's not interactive):
>
> /bin/tar -xf /var/tmp/deploy.tar -C /var/tmp
>
> Another possible issue: If you want /var/tmp/deploy.tar to extract to
> /var/tmp/test, then you need to leave off the 'onlyif' parameter. Currently,
> the exec will only run if /var/tmp/test already exists.
>
> One last thing. If you haven't done so already, set up a dependency between
> the file resource that copies the tar file to the node and the exec resource
> that extracts it -- either via a notify parameter in the file resource or a
> require parameter in the exec resource.
>
> --
> Peter Bukowinski
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/gOIxni7fKGIJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.