2023-01-15 09:18:15 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
roles = []
|
|
|
|
excluded = ['common-suse', 'minion']
|
|
|
|
|
|
|
|
def get():
|
2023-01-21 14:52:48 +01:00
|
|
|
for root in ['pillar', 'salt']:
|
|
|
|
for rootdir, subdirs, files in os.walk(os.path.join(root, 'role')):
|
2023-01-21 19:40:19 +01:00
|
|
|
myrootdir = rootdir.split('/')
|
|
|
|
if len(myrootdir) > 2:
|
|
|
|
level = myrootdir[2:]
|
2023-01-21 14:52:48 +01:00
|
|
|
for file in files:
|
2023-01-21 19:40:19 +01:00
|
|
|
splitfile = os.path.splitext(file)
|
|
|
|
if len(splitfile) == 2 and splitfile[1] == '.sls':
|
|
|
|
role = os.path.splitext(file)[0]
|
|
|
|
if len(myrootdir) > 2:
|
|
|
|
role = '.'.join(level) + '.' + role
|
|
|
|
if not role in excluded and not role in roles:
|
|
|
|
roles.append(role)
|
2023-01-15 09:18:15 +01:00
|
|
|
return roles
|
2023-01-21 14:52:48 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
print(get())
|