Download:
child 92:4a5befc06310
parent 90:c8e8f09464cf
91:851d44214ed2
Anton Shestakov <av6@dwimlabs.net>, Sun, 03 Jul 2016 23:27:49 +0800
checker: prevalidate config (basic checks)

1 файлов изменено, 21 вставок(+), 6 удалений(-) [+]
checker.py file | annotate | diff | comparison | revisions
--- a/checker.py Sun Jul 03 23:15:56 2016 +0800
+++ b/checker.py Sun Jul 03 23:27:49 2016 +0800
@@ -63,18 +63,33 @@
return None
+def prevalidate(config):
+ ok = True
+
+ if 'url' not in config:
+ print("# C&O config doesn't have 'url' defined.")
+ ok = False
+
+ if 'scm' not in config:
+ print("# C&O config doesn't have 'scm' defined.")
+ ok = False
+ elif config['scm'] != 'hg':
+ print("# C&O checker doesn't support {} yet.".format(config['scm']))
+ ok = False
+
+ if not ok:
+ print('# C&O job failed')
+
+ return ok
+
+
def execute(config):
print('# C&O job started: {}'.format(now()))
tmp = mkdtemp(prefix='candolint.')
os.chdir(tmp)
- ok = True
source = './source'
-
- if 'url' not in config:
- print("# C&O config doesn't have url defined.")
- print('# C&O job failed')
- ok = False
+ ok = prevalidate(config)
if ok:
print('# C&O task: clone')