Starting to add additional unit tests for VariableManager

Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
This commit is contained in:
James Cammarata 2015-09-04 16:41:38 -04:00
parent 87f75a50ad
commit ff9f5d7dc8
13 changed files with 233 additions and 54 deletions

View file

@ -57,6 +57,10 @@ class DictDataLoader(DataLoader):
def list_directory(self, path):
return [x for x in self._known_directories]
def is_executable(self, path):
# FIXME: figure out a way to make paths return true for this
return False
def _add_known_directory(self, directory):
if directory not in self._known_directories:
self._known_directories.append(directory)