web_app always runs a2ensite?


#1

I’m using the web_app resource from the apache2 cookbook to set up
multiple sites in apache, and I’ve noticed that it seems to be
ignoring the “enable” value.

web_app("foo.example.com") do
  docroot   "/var/www/foo/"
  template  "apache.conf.erb"
  enable    false
end

web_app("bar.example.com") do
  docroot   "/var/www/bar/"
  template  "apache.conf.erb"
  enable    false
end

In the above example, a2ensite is run for both foo.example.com and
bar.example.com. I also tried including “apache_site” at the end of my
recipe to disable a site:

apache_site "foo.example.com" do
  enable false
end

The output from chef-client also includes this, which makes me scratch
my head, because the config files for both sites are still getting
symlinked into /etc/apache2/sites-enabled.

108.166.121.69 [Thu, 26 Jan 2012 17:46:46 +0000] INFO: Processing
execute[a2ensite foo.example.com.conf] action run
(apache_test::default line 24)
108.166.121.69 [Thu, 26 Jan 2012 17:46:46 +0000] INFO: Processing
execute[a2ensite bar.example.com.conf] action run
(apache_test::default line 24)

108.166.121.69 [Thu, 26 Jan 2012 17:46:46 +0000] INFO: Processing
execute[a2dissite foo.example.com] action run (apache_test::default
line 34)

Am I completely misuderstanding something here, or does this not work
as expected.

Thanks in advance,

  • Brad