Benjamin,

Why are you doing this? This kind of situation usually indicates a
need to adjust one's mindset in order to work within the Puppet model
rather than fighting against it.

That said, I think you could do this a couple ways:

1) An Exec resource with 'onlyif' and make the File resource depend on it.
2) A custom fact that checks for the existence of the directory,
combined with 'if' statements around the File resource.

Still, I think you'll get more mileage out of telling us what problem
you are trying to solve so we can help you figure out the best way to
solve that problem within the Puppet model.

--Paul

On Fri, Nov 14, 2008 at 9:14 AM, benjamin <[EMAIL PROTECTED]> wrote:
>
> i need to copy a file into a directory if that directory exists.
>
> simple enough to instantiate the file type.. put this file there..
>
> and if the path doesn't exist the ensure fails.. but with an error.
>
> it would be great if the File type supported an onlyif parameter
> similar to Exec so that the copy would not be attempted if the target
> directory did not exist ie.
> onlyif => "test -d /my/path"
>
> i thought i could find a way to use the require metaparameter by first
> declaring the target directory:
>
> file { "/my/path" : alias => target }
> file { "/my/path/file" : ..etc.., require => File[target] }
>
> but this just kicks out the same kind of error but on the first File
> since i don't want to explicitly create the directory (ensure =>
> directory)
>
> can anyone propose a solution for copying a file to a puppet client
> system only if the target exists without generating errors ?
>
> >
>

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

Reply via email to