Skip to content

Commit

Permalink
Rename libexec_dir to apache_libexec_dir (#678)
Browse files Browse the repository at this point in the history
* Rename libexec_dir to apache_libexec_dir

This works around an issue when using this cookbook with the docker cookbook at
the same time. They both have a function called ``libexec_dir`` and docker seems
to override this cookbook. To work around this, renaming our function to
``apache_libexec_dir`` seems to work.

This resolves #677.

* Disable MD024 because we follow Keep A Changelog syntax which conflicts
  • Loading branch information
ramereth authored Apr 12, 2020
1 parent 8984ae4 commit 3b6f9bc
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .mdlrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rules "~MD013"
rules "~MD013", "~MD024"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ This file is used to list changes made in each version of the apache2 cookbook.

## Unreleased

### Added

- Add CentOS 8 to CI pipeline
- Add Debian 10 / Remove Debian 8 from CI pipeline

### Changed

- Rename libexec_dir to apache_libexec_dir

## [8.1.0] - 2020-03-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def lib_dir
end
end

def libexec_dir
def apache_libexec_dir
if platform_family?('freebsd') || platform_family?('suse')
lib_dir
else
Expand Down
2 changes: 1 addition & 1 deletion resources/mod_auth_cas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
execute 'compile mod_auth_cas' do
command './configure && make && make install'
cwd '/tmp/mod_auth_cas'
not_if "test -f #{libexec_dir}/mod_auth_cas.so"
not_if "test -f #{apache_libexec_dir}/mod_auth_cas.so"
end

template "#{apache_dir}/mods-available/auth_cas.load" do
Expand Down
2 changes: 1 addition & 1 deletion resources/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
description: 'The full name of the file'

property :path, String,
default: lazy { "#{libexec_dir}/#{mod_name}" },
default: lazy { "#{apache_libexec_dir}/#{mod_name}" },
description: ''

property :identifier, String,
Expand Down
94 changes: 94 additions & 0 deletions spec/libraries/apache_libexec_dir_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
require 'spec_helper'

RSpec.describe Apache2::Cookbook::Helpers do
class DummyClass < Chef::Node
include Apache2::Cookbook::Helpers
end

subject { DummyClass.new }

describe '#apache_libexec_dir' do
before do
allow(subject).to receive(:[]).with('platform_family').and_return(platform_family)
allow(subject).to receive(:[]).with(:platform_family).and_return(platform_family)
allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine)
end
context 'x86_64' do
let(:machine) { 'x86_64' }

context 'redhat' do
let(:platform_family) { 'rhel' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib64/httpd/modules' }
end

context 'fedora' do
let(:platform_family) { 'fedora' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib64/httpd/modules' }
end

context 'amazon' do
let(:platform_family) { 'amazon' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib64/httpd/modules' }
end

context 'suse' do
let(:platform_family) { 'suse' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib64/apache2' }
end

context 'debian' do
let(:platform_family) { 'debian' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/apache2/modules' }
end

context 'arch' do
let(:platform_family) { 'arch' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/httpd/modules' }
end

context 'freebsd' do
let(:platform_family) { 'freebsd' }
it { expect(subject.apache_libexec_dir).to eq '/usr/local/libexec/apache24' }
end
end

context 'x86' do
let(:machine) { 'i686' }

context 'redhat' do
let(:platform_family) { 'rhel' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/httpd/modules' }
end

context 'fedora' do
let(:platform_family) { 'fedora' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/httpd/modules' }
end

context 'amazon' do
let(:platform_family) { 'amazon' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/httpd/modules' }
end

context 'suse' do
let(:platform_family) { 'suse' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/apache2' }
end

context 'debian' do
let(:platform_family) { 'debian' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/apache2/modules' }
end

context 'arch' do
let(:platform_family) { 'arch' }
it { expect(subject.apache_libexec_dir).to eq '/usr/lib/httpd/modules' }
end

context 'freebsd' do
let(:platform_family) { 'freebsd' }
it { expect(subject.apache_libexec_dir).to eq '/usr/local/libexec/apache24' }
end
end
end
end
89 changes: 0 additions & 89 deletions spec/libraries/lib_exec_dir_spec.rb

This file was deleted.

0 comments on commit 3b6f9bc

Please sign in to comment.