Support globstar for recursion

This commit is contained in:
Chris MacNaughton
2019-01-29 14:49:03 +01:00
parent cd6ad8485f
commit 774a49faef
2 changed files with 5 additions and 2 deletions

View File

@@ -37,7 +37,8 @@ class TestFileAssertionUtils(ut_utils.BaseTestCase):
file_assertions.assert_path_glob(
self._assert, 'test/0', file_details)
self.run_on_unit.assert_called_once_with(
'test/0', 'stat -c "%n %U %G %a" *')
'test/0', 'bash -c "shopt -s -q globstar;'
' stat -c "%n %U %G %a" *"')
def test_single_path(self):
self.run_on_unit.return_value = {

View File

@@ -20,7 +20,9 @@ import zaza.model as model
def assert_path_glob(test_case, unit, file_details, paths=[]):
"""Verify all files in a given directory."""
result = model.run_on_unit(
unit, 'stat -c "%n %U %G %a" {}'.format(file_details['path']))
unit, 'bash -c "'
'shopt -s -q globstar; '
'stat -c "%n %U %G %a" {}"'.format(file_details['path']))
files = result['Stdout']
for file in files.splitlines():
file, owner, group, mode = file.split()