httpd icon indicating copy to clipboard operation
httpd copied to clipboard

Deleting a module should not delete mods-available directory

Open e21347 opened this issue 8 years ago • 1 comments

Cookbook version

0.4.5

Chef-client version

12.21.1

Platform Details

Ubuntu 16.04

Scenario:

Remove an existing module without deleting /etc/apache2-some-name/mods-available directory.

Steps to Reproduce:

# metadata.rb
...
depends 'httpd', '~> 0.4.5'
# recipes/default.rb
httpd_service 'sample_app_demo' do
  listen_ports ['8082']
  action [:create, :start]
  run_user 'sample_app'
  run_group 'sample_app'
end

httpd_module 'passenger' do
  action :create
  instance 'sample_app_demo'
  notifies :restart, 'httpd_service[sample_app_demo]'
end

kitchen converge

# recipes/default.rb
httpd_service 'sample_app_demo' do
  listen_ports ['8082']
  action [:create, :start]
  run_user 'sample_app'
  run_group 'sample_app'
end

httpd_module 'passenger' do
  action :delete
  instance 'sample_app_demo'
  notifies :restart, 'httpd_service[sample_app_demo]'
end

kitchen converge

Expected Result:

# httpd/libraries/httpd_module_debian.rb
...
    action :delete do
      link "/etc/#{apache_name}/mods-enabled/#{module_name}.load" do
        action :delete
      end

      file "/etc/#{apache_name}/mods-available/#{module_name}.load" do
        action :delete
      end

    end
...

Actual Result:

# httpd/libraries/httpd_module_debian.rb
...
    action :delete do
      directory "/etc/#{apache_name}/mods-available" do
        recursive true
        action :delete
      end

      file "/etc/#{apache_name}/mods-available/#{module_name}.load" do
        action :delete
      end

      link "/etc/#{apache_name}/mods-enabled/#{module_name}.load" do
        action :delete
      end
    end
...

e21347 avatar Jun 22 '17 05:06 e21347

Apologies for the flip-flop here. Thanks for reporting this. It's a bug that should get fixed.

mods-available shouldn't get removed if a module is deleted. just the module that is being deleted.

vagrant@default-ubuntu-1604:/etc/apache2-sample_app_demo$ ls apache2.conf conf-available conf-enabled envvars mime.types mods-enabled sites-available sites-enabled

iennae avatar Oct 19 '17 04:10 iennae