Hi,

I'm trying to generate apache virtual host configs and I have run  
into what I think is a bug.  Here is my setup:

CentOS 5.3
puppet 0.24.8
puppetmaster 0.24.8

Here is my template for the vhost configuration:
-- vhost2.erb --
NameVirtualHost <%= name %>:<%= port %>

<VirtualHost <%= name %>:<%= port %>>
<% if has_variable?("server_admin") and server_admin != "undef" then %>
         ServerAdmin <%= server_admin %>
<% else %>
         ServerAdmin root@<%= name %>
<% end %>
         ServerName <%= name %>

         CustomLog /var/log/httpd/<%= name %>-access_log combined
         ErrorLog /var/log/httpd/<%= name %>-error_log

         DocumentRoot /var/www/html-<%= name %>

         <%= vhost_config %>
</VirtualHost>
-- end vhost2.erb --

Here is the define for calling the template:
-- apache.pp --
class apache {
         define vhost2 ( $vhost_config, $port = 80, $server_admin =  
undef ) {
                 file { "$name.conf":
                         name => $operatingsystem ? {
                                 FreeBSD => "/usr/local/etc/apache22/ 
Includes/$name.conf",
                                 Solaris => "/etc/apache/$name.conf",
                                 default => "/etc/httpd/conf.d/ 
$name.conf",
                         },
                         ensure => present,
                         mode => 644,
                         content => template('vhost2.erb'),
                         notify => [ Service['httpd'], ],
                 }
         }
...
}
-- end apache.pp --

and here is how I call it:

         apache::vhost2 { "repo.$domain":
                 vhost_config => "
         <Directory \"/var/www/html-repo.$domain\">
                 Options FollowSymLinks Indexes
                 AllowOverride None
                 Order allow,deny
                 Allow from all
         </Directory>",
         }

This is what I get:

-- repo.home.pirzyk.org.conf --
NameVirtualHost repo.home.pirzyk.org:80

<VirtualHost repo.home.pirzyk.org:80>

       ServerAdmin undef

       ServerName repo.home.pirzyk.org

       CustomLog /var/log/httpd/repo.home.pirzyk.org-access_log combined
       ErrorLog /var/log/httpd/repo.home.pirzyk.org-error_log

       DocumentRoot /var/www/html-repo.home.pirzyk.org


       <Directory "/var/www/html-repo.home.pirzyk.org">
               Options FollowSymLinks Indexes
               AllowOverride None
               Order allow,deny
               Allow from all
       </Directory>
</VirtualHost>
-- end repo.home.pirzyk.org.conf --

If I set server_admin in the apache::vhost2 call, it does work  
correctly, just not if it is set to 'undef'

- JimP

--- @(#) $Id: dot.signature,v 1.15 2007/12/27 15:06:13 pirzyk Exp $
     __o  j...@pirzyk.org -------------------------------------------
  _'\<,_
(*)/ (*) I'd rather be out biking.

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to