-
Notifications
You must be signed in to change notification settings - Fork 34
/
batchvalidate.py
executable file
·46 lines (43 loc) · 1.53 KB
/
batchvalidate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
import sys
import os
import subprocess
import argparse
import validate
def parse_args():
'''
Parse command line arguments
'''
parser = argparse.ArgumentParser(description='Recursively launch validate.py')
parser.add_argument('input', help='full path to manifest file')
parser.add_argument('-y', help ='invokes -y option in validate.py, answers Y to manifest issues', action='store_true')
parsed_args = parser.parse_args()
return parsed_args
def main():
args = parse_args()
source = args.input
results = []
for root, dirname, filenames in os.walk(source):
error_counter = 0
for files in filenames:
if files.endswith('_manifest.md5'):
if os.path.basename(root) != 'logs':
manifest = os.path.join(root, files)
print(manifest)
if os.path.isfile(manifest):
if args.y:
error_counter = validate.main([manifest, '-y'])
else:
error_counter = validate.main([manifest])
if error_counter == 0:
results.append([root, 'success'])
else:
results.append([root, 'failure'])
for result in results:
print(result)
else:
continue
for result in results:
print(result)
if __name__ == '__main__':
main()