Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting default_site_enabled false does not disable default site on Ubuntu 14.04 #146

Closed
razor-x opened this issue Jun 22, 2014 · 5 comments

Comments

@razor-x
Copy link

razor-x commented Jun 22, 2014

Setting node['apache']['default_site_enabled'] = false does not actually disable the default site on Ubuntu 14.04. (This is on COOK-3900 branch.)

The a2dissite and a2ensite scripts do not correctly add the 000- priority prefix when default is given (even though it seems this functionality is intended).

I am running Ruby 2.1.2 and Vagrant 1.6.3-1 on Arch Linux.

To reproduce:

$ git clone https://gist.github.com/e795303129cc8a5563fa.git
$ cd e795303129cc8a5563fa
$ git checkout ca61368b814fe4f0a79d7c45986021ee17d09c9d
$ bundle
$ kitchen converge
$ kitchen login

Then on the VM:

vagrant@default-ubuntu-1404:/etc/apache2$ ls -l sites-available/
total 16
-rw-r--r-- 1 root root 1332 Jan  7 13:23 000-default.conf
-rw-r--r-- 1 root root 1337 Jun 22 18:22 default
-rw-r--r-- 1 root root 6437 Jan  7 13:23 default-ssl.conf
vagrant@default-ubuntu-1404:/etc/apache2$ ls -l sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 Jun 22 18:22 000-default.conf -> ../sites-available/000-default.conf
vagrant@default-ubuntu-1404:/etc/apache2$ sudo a2dissite default
ERROR: Site default does not exist!
vagrant@default-ubuntu-1404:/etc/apache2$ sudo a2ensite default
ERROR: Site default does not exist!
vagrant@default-ubuntu-1404:/etc/apache2$ sudo a2dissite 000-default
Site 000-default disabled.
To activate the new configuration, you need to run:
  service apache2 reload
vagrant@default-ubuntu-1404:/etc/apache2$ ls sites-enabled/
vagrant@default-ubuntu-1404:/etc/apache2$
@razor-x
Copy link
Author

razor-x commented Jun 22, 2014

In addition to the issue with the 000-, I think these lines and these lines are also part of the issue.

Specifically, the site config files now end in .conf, but the not_if / only_if tests miss files with that extension (also mentioned in #132):

::File.symlink?("#{node['apache']['dir']}/sites-enabled/#{params[:name]}") ||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/000-#{params[:name]}")

This makes sense as my current workaround is

apache_site '000-default.conf' do
  enable node['apache']['default_site_enabled']
end

@drpebcak
Copy link
Contributor

@razor-x the a2_.erb files that are in the cookbook are only there to recreate some of the capabilities if the ubuntu/debian a2_ commands (meaning the smartness of adding 000- to default only exists there as far as I know). You would have to specify a2dissite 000-default to disable the default site.

I've added .conf to those File.symlink? lines (I actually just added more OR statements to include situations where .conf is not included - for cases where people use apache2.2).

@drpebcak
Copy link
Contributor

@razor-x let me know if the latest commits to https://github.com/drpebcak/apache2/tree/COOK-3900 solves this for you.

@mariomarin
Copy link

@drpebcak Using cookbook 'apache2', github: 'drpebcak/apache2', branch: 'COOK-3900' worked. Thank you.

drpebcak added a commit that referenced this issue Jun 24, 2014
@svanzoest svanzoest added this to the apache 2.4 support milestone Jul 29, 2014
@svanzoest svanzoest added the bug label Jul 29, 2014
@lock
Copy link

lock bot commented Jul 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants