2016-12-22 01:46:28 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import textwrap
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
targets_dir = 'test/integration/targets'
|
|
|
|
|
|
|
|
with open('test/integration/target-prefixes.network', 'r') as prefixes_fd:
|
|
|
|
network_prefixes = prefixes_fd.read().splitlines()
|
|
|
|
|
|
|
|
for target in sorted(os.listdir(targets_dir)):
|
|
|
|
target_dir = os.path.join(targets_dir, target)
|
|
|
|
aliases_path = os.path.join(target_dir, 'aliases')
|
|
|
|
files = sorted(os.listdir(target_dir))
|
|
|
|
|
|
|
|
# aliases already defined
|
|
|
|
if os.path.exists(aliases_path):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# don't require aliases for support directories
|
2017-02-22 21:04:09 +01:00
|
|
|
if any(os.path.splitext(f)[0] == 'test' and os.access(os.path.join(target_dir, f), os.X_OK) for f in files):
|
2016-12-22 01:46:28 +01:00
|
|
|
continue
|
|
|
|
|
|
|
|
# don't require aliases for setup_ directories
|
|
|
|
if target.startswith('setup_'):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# don't require aliases for prepare_ directories
|
|
|
|
if target.startswith('prepare_'):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# TODO: remove this exclusion once the `ansible-test network-integration` command is working properly
|
|
|
|
# don't require aliases for network modules
|
|
|
|
if any(target.startswith('%s_' % prefix) for prefix in network_prefixes):
|
|
|
|
continue
|
|
|
|
|
2018-02-28 00:05:39 +01:00
|
|
|
print('%s: missing integration test `aliases` file' % aliases_path)
|
2016-12-22 01:46:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|