pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

Custom Modules / ApacheConfig Module

Open barnabasJ opened this issue 7 years ago • 0 comments

Hi

Before deciding which Infrastructure test framework to use, I looked at what Inspec, Goss, and Testinfra had to offer. And I liked Testinfra the most for my use case. One of the things I had to do was create some kind of audit which checked if the configuration of our apache webservers changed and if the changes were somehow relevant for our security policies. I, therefore, created the ApacheConfig Module, which I took inspiration from Inspec which had a similar Resource to access the Apache configuration. I do agree that it would have been possible to do everything with just the file module. But the ApacheConfig Module made it a lot more comfortable, making it possible to access different configuration options as a dictionary and the ability to parse all config files at once (the external library I used to parse the configuration knows how to handle the include statements inside the Apache configuration files and parses the complete configuration into one dictionary plus a couple other nice features). I was wondering what your stance on new modules is in general. Do you prefer the more basic approach goss uses with modules to test most important things and using the ability to execute shell commands and accessing their output to test everything else or the approach I saw in Inspec with a module for pretty much anything? As a compromise, it might also be possible to implement something similar to Inspec custom resources where it is possible to place your resource files in a folder where they will be picked up by the framework.

I'm looking forward to hearing your thoughts on the matter.

barnabasJ avatar Sep 14 '18 11:09 barnabasJ