[Puppet Users] Re: create a file only if directory exists

2008-11-21 Thread Hang Chan
> Then you'll probably have to copy down the configuration file into a > separate location, and use an exec to cp it into the proper destination > with an onlyif test. That sounds like a good suggestion. Have to stop being so straightforward with my thinking. On Nov 21, 11:30 am, Mike Renfro <[

[Puppet Users] Re: create a file only if directory exists

2008-11-21 Thread Mike Renfro
On 11/21/2008 10:18 AM, Hang Chan wrote: > I looked through his definitions and it only checks if the proper > packages exists before setting up his configuration files. site.pp also includes an apache::site definition that can create or remove a configuration file depending on if you call the

[Puppet Users] Re: create a file only if directory exists

2008-11-21 Thread Hang Chan
I looked through his definitions and it only checks if the proper packages exists before setting up his configuration files. I need to check if the directory exists as a condition. I don't want to create the directory if it doesn't, as it is created manually right now and needs to stay that way

[Puppet Users] Re: create a file only if directory exists

2008-11-21 Thread Mike Renfro
Hang Chan wrote: > I don't need puppet to create the /var/www/html/site1 directory as > that is created manually. Want puppet to check If the /var/www/html/ > site1 directory exists and create the /apps/apache/conf.d/site1.conf > file if it does. Also need puppet to delete the /apps/apache/conf

[Puppet Users] Re: create a file only if directory exists

2008-11-21 Thread Hang Chan
I'm trying to create a virtual host file only if the document root directory exists. I could care less what method I use as long as it works. Please let me know the best way to do this. I realize now that require won't accomplish what I want. I don't need puppet to create the /var/www/html/sit

[Puppet Users] Re: create a file only if directory exists

2008-11-20 Thread Andrew Shafer
hardcoding what? what are you trying to debug? Read what 'require' does. Require is not a conditional branch, it makes ordering explicit. Exec with onlyif is one way you could get the behavior, or an if condition with a custom fact would. There might be another way too. I believe all of those

[Puppet Users] Re: create a file only if directory exists

2008-11-20 Thread Hang Chan
I'm just hardcoding it to debug it, actual configuation isn't like this. I tried it the other way too and it's still creating the file. file { "/apps/apache/conf.d/site1.conf": ensure => present, content => template("apache/virtual_host.erb"), notify => Service["jboss_apa

[Puppet Users] Re: create a file only if directory exists

2008-11-20 Thread Andrew Shafer
Hang, The 'require' is going to look for a resource definition and make sure that the current resource is applied later. 'require' establishes explicit order, not conditional logic. Also... Please don't take what I'm about to write the wrong way. Are you familiar with the concept of 'code smells

[Puppet Users] Re: create a file only if directory exists

2008-11-20 Thread joe
Your require is actually creating the site1 directory if it doesn't exist (unless your file def. for that directory has ensure => absent). I think you want to go the other way and ensure that the site1.conf is created by the definition for the site1 directory. In other words, put a require for th