-
Notifications
You must be signed in to change notification settings - Fork 680
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
apache_conf resource seems to be using incorrect paths to amalgamate apache config (only Centos/RHEL?) #1013
Comments
@chris-rock @jeremymv2 I just upgraded to 0.33.0 but am still having this issue with the
This was after uninstalling 0.29.0 with the following command:
It looks like the |
If the path is absolute, just use what was passed, otherwise build an absolute path using `@conf_dir`. Fixes inspec#1013 I've got what seemed to me to be the necessary ingredients for a successful unit test. I added the mock file and referenced it in `helper.rb` both in the commands hash and files hash. Using `binding.pry` I saw that the path was valid when it got sent through the `mockfile` lamda, but the test is erroring when it gets to `ApacheConf#read_content` at line 79 where `read_file(to_read[0])` is called. Apparently at that point it can't find the file. Could someone with more familiarity with the mocking system tell me what I'm missing there? :)
If the path is absolute, just use what was passed, otherwise build an absolute path using `@conf_dir`. Fixes #1013 I've got what seemed to me to be the necessary ingredients for a successful unit test. I added the mock file and referenced it in `helper.rb` both in the commands hash and files hash. Using `binding.pry` I saw that the path was valid when it got sent through the `mockfile` lamda, but the test is erroring when it gets to `ApacheConf#read_content` at line 79 where `read_file(to_read[0])` is called. Apparently at that point it can't find the file. Could someone with more familiarity with the mocking system tell me what I'm missing there? :)
If the path is absolute, just use what was passed, otherwise build an absolute path using `@conf_dir`. Fixes inspec#1013
Is this issue resolved |
Yes, a PR was merged to address it on Sep 9, 2016. |
Description
The Compliance tests I'm writing make heavy use of the
apache_conf
resource to validatehttpd
configuration. As I understand it, the resource builds a hash accessible viaapache_conf.params
by gathering all.conf
and.load
files in the files in apache/httpd config directory and combining them.The problem is that the resource seems to be using incorrect paths and is therefore failing to find anything but my standard
/etc/httpd/conf/httpd.conf
file.Here is an example of a simple test:
When I run
$ chef exec kitchen verify
, I can see this output in stdout:As you can see, it's failing to find any files, and the find path looks odd:
/etc/httpd/conf/etc/httpd/sites-enabled
. The standard path tosites-enabled
is/etc/httpd/sites-enabled
, same withmods-enabled
etc.Perplexed, I generated a new dummy cookbook to start from scratch and use Centos 7.2 for good measure. All I changed was installing Apache via
package 'httpd'
in the default recipe, which will grab version 2.4 for Centos 7. Added a similar test usingapache_conf
and got the following output:Something seems off, as my default
conf.d
andconf.modules.d
are in/etc/httpd
, not/etc/httpd/conf
.Still curious, I added Ubuntu 14.04 to the platforms in my dummy cookbook's kitchen config, installed
apache2
and didn't get any failure outputs when running the test.InSpec and Platform Version
Tested on:
Windows 7 Enterprise, SP1
ChefDK 0.17.17
kitchen 1.11.1
apache 2.2 installed with community/supermarket apache2 cookbook
Virtual Box + Centos 6.7 for running tests
Replication Case
$ chef generate cookbook test
package 'httpd'
to default recipecentos-6.7
and/orcentos-7.2
as platforms inkitchen.yml
test/recipes/default_test.rb
that usesapache_conf
$ kitchen verify
Stacktrace
See stdout content pasted above.
The text was updated successfully, but these errors were encountered: