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 idioms are going to be clumsy and hard to manage. What is your end goal? On Thu, Nov 20, 2008 at 2:34 PM, Hang Chan <[EMAIL PROTECTED]> wrote: > > 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_apache"], > # require => File["/var/www/html/site1"] > } > > file { "/var/www/html/site1": > require => File["/apps/apache/conf.d/site1.conf"] > } > > Is the way to approach this to use the exec type and onlyif resource? > > On Nov 20, 3:36 pm, joe <[EMAIL PROTECTED]> wrote: > > 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 the site1.conf in the file definition for the site1 > > directory. > > > > On Nov 20, 3:05 pm, Hang Chan <[EMAIL PROTECTED]> wrote: > > > > > I'm trying to create a virtual host file only if the document root > > > directory exists. It doesn't look like puppet is seeing the require > > > metaparameter. Currently, the file is being created whether or not > > > the document root directory exists. What is the best way to currently > > > do this? > > > > > I'm trying to create a file called site1.conf in /apps/apache/conf.d > > > only if /var/www/html/site1 directory exists. > > > > > file { "/apps/apache/conf.d/site1.conf": > > > ensure => present, > > > content => template("apache/virtual_host.erb"), > > > notify => Service["jboss_apache"], > > > require => File["/var/www/html/site1"] > > > } > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---