Skip to content

Commit

Permalink
Add post-processing to check for fuse. Closes #355
Browse files Browse the repository at this point in the history
  • Loading branch information
infinitewarp committed Jan 17, 2018
1 parent 74bdbfe commit 85c3100
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions quipucords/scanner/network/processing/eap.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,11 @@ class ProcessEapHomeCat(CatResultsProcessor):
"""Process the output of 'cat .../version.txt'."""

KEY = 'eap_home_version_txt'


class ProcessEapHomeBinForFuse(IndicatorFileFinder):
"""Process the output of 'ls -1' for eap_home_bin to check for fuse."""

KEY = 'eap_home_bin'

INDICATOR_FILES = ['fuseconfig.sh', 'fusepatch.sh']
32 changes: 32 additions & 0 deletions quipucords/scanner/network/processing/tests_eap.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,35 @@ def test_eap(self):
processor.process(
ansible_result(' foo\n eap bar\n baz eap')),
['eap bar'])


class TestProcessEapHomeBinForFuse(unittest.TestCase):
"""Test looking for fuse scripts."""

def test_fuse_not_found(self):
"""Test failure to find a fuse script."""
found_files = ['foo.sh', 'README']

processor_input = ansible_results([{
'item': '/some/dir',
'stdout': '\n'.join(found_files)
}])
expected_result = {
'/some/dir': []
}
actual_result = eap.ProcessEapHomeBinForFuse.process(processor_input)
self.assertEqual(actual_result, expected_result)

def test_fuse_is_found(self):
"""Test successfully finding a fuse script."""
found_files = ['foo.sh', 'README'] + \
eap.ProcessEapHomeBinForFuse.INDICATOR_FILES[:-1]
processor_input = ansible_results([{
'item': '/some/dir',
'stdout': '\n'.join(found_files)
}])
expected_result = {
'/some/dir': eap.ProcessEapHomeBinForFuse.INDICATOR_FILES[:-1]
}
actual_result = eap.ProcessEapHomeBinForFuse.process(processor_input)
self.assertEqual(actual_result, expected_result)

0 comments on commit 85c3100

Please sign in to comment.