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

Fix apache conf #1014

Merged
merged 7 commits into from
Sep 4, 2016
Merged

Fix apache conf #1014

merged 7 commits into from
Sep 4, 2016

Conversation

jeremymv2
Copy link
Contributor

@jeremymv2 jeremymv2 commented Sep 2, 2016

apache_conf.conf_dir was resolving incorrectly when OS was NOT Ubuntu || Debian.

It would end up resulting in find_file() exit 1 errors like below:

[vagrant@default-centos-67 ~]$ /opt/chef/embedded/bin/inspec shell
Welcome to the interactive InSpec Shell
To find out how to use it, type: help

inspec> apache_conf
find_files(): exit 1 from `find /etc/httpd/conf/conf.d/*.conf -maxdepth 1 -type f`
=> Apache Config /etc/httpd/conf/httpd.conf
inspec>

It should be using a conf_dir of /etc/httpd so that find_files will search /etc/httpd/conf.d/*.conf instead of /etc/httpd/conf/conf.d/*.conf.

This PR corrects the problem and resolves #1013

@jeremymv2
Copy link
Contributor Author

@davidcpell this should fix your issue

@@ -21,7 +21,7 @@ class ApacheConf < Inspec.resource(1)

def initialize(conf_path = nil)
@conf_path = conf_path || inspec.apache.conf_path
@conf_dir = File.dirname(@conf_path)
@conf_dir = inspec.os.debian? ? File.dirname(@conf_path) : inspec.apache.conf_dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremymv2 I am thinking about moving that logic to inspec.apache. So we would use File.dirname(@conf_path) only if conf_path is defined. Otherwise we always read the conf_dir from the apache resource. What do you think?

@chris-rock
Copy link
Contributor

This is a great improvement of our test coverage @jeremymv2

@chris-rock chris-rock merged commit a116406 into inspec:master Sep 4, 2016
@chris-rock
Copy link
Contributor

Thanks a lot @jeremymv2 💯

@chris-rock chris-rock modified the milestone: 0.33.0 Sep 5, 2016
@jeremymv2 jeremymv2 deleted the fix_apache_conf branch September 6, 2016 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apache_conf resource seems to be using incorrect paths to amalgamate apache config (only Centos/RHEL?)
3 participants