blob: a295886d724976650bd7c25d64ea9e48294a0e37 [file] [log] [blame]
James E. Blair6cdf2f22016-07-25 16:07:02 -07001#!/usr/bin/env python
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import argparse
16import os
17import sys
18
James E. Blair8a3729d2017-01-26 09:55:33 -080019FIXTURE_DIR = os.path.join(os.path.dirname(__file__),
20 'fixtures')
21CONFIG_DIR = os.path.join(FIXTURE_DIR, 'config')
James E. Blair6cdf2f22016-07-25 16:07:02 -070022
23
24def print_file(title, path):
25 print('')
26 print(title)
27 print('-' * 78)
28 with open(path) as f:
29 print(f.read())
30 print('-' * 78)
31
32
33def main():
34 parser = argparse.ArgumentParser(description='Print test layout.')
35 parser.add_argument(dest='config', nargs='?',
36 help='the test configuration name')
37 args = parser.parse_args()
38 if not args.config:
39 print('Available test configurations:')
40 for d in os.listdir(CONFIG_DIR):
41 print(' ' + d)
42 sys.exit(1)
43 configdir = os.path.join(CONFIG_DIR, args.config)
44
45 title = ' Configuration: %s ' % args.config
46 print('=' * len(title))
47 print(title)
48 print('=' * len(title))
49 print_file('Main Configuration',
50 os.path.join(configdir, 'main.yaml'))
51
52 gitroot = os.path.join(configdir, 'git')
53 for gitrepo in os.listdir(gitroot):
54 reporoot = os.path.join(gitroot, gitrepo)
55 print('')
56 print('=== Git repo: %s ===' % gitrepo)
57 filenames = os.listdir(reporoot)
58 for fn in filenames:
59 if fn in ['zuul.yaml', '.zuul.yaml']:
60 print_file('File: ' + os.path.join(gitrepo, fn),
61 os.path.join(reporoot, fn))
62
63
64if __name__ == '__main__':
65 main()