diff options
-rwxr-xr-x | bin/roles.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/roles.py b/bin/roles.py index 1777f8c..32de0cf 100755 --- a/bin/roles.py +++ b/bin/roles.py @@ -6,8 +6,13 @@ roles = [] excluded = ['common-suse', 'minion'] def get(): - for file in os.listdir('salt/role'): - role = os.path.splitext(file)[0] - if not role in excluded: - roles.append(role) + for root in ['pillar', 'salt']: + for rootdir, subdirs, files in os.walk(os.path.join(root, 'role')): + for file in files: + role = os.path.splitext(file)[0] + if not role in excluded and not role in roles: + roles.append(role) return roles + +if __name__ == '__main__': + print(get()) |