From d19f46bfe5ac9d754a901862c43d06f09e3788d9 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Oct 30 2019 14:04:49 +0000 Subject: throw a better error message when the localdir, remotedir or desturl do not match the proper regex --- diff --git a/cclint b/cclint index 1e800b6..7168021 100755 --- a/cclint +++ b/cclint @@ -44,10 +44,15 @@ def main(files=[]): raise AssertionError for attr in ['localdir','remotedir','desturl']: - are = re.match(MIRRORREGEX, se._asdict()[attr]).groupdict() - if are['centosversion'] != gs['centosversion']: - msg = 'version location of {0} does not match the CentOS Version of the CBS tag'.format(attr) - raise AssertionError + match = re.match(MIRRORREGEX, se._asdict()[attr]) + if not match: + msg = 'Malformed directory: {}\n {} does not match pattern: {}'.format(se._asdict()[attr], attr, MIRRORREGEX) + raise AssertionError + are = match.groupdict() + + if are['centosversion'] != gs['centosversion']: + msg = 'version location of {0} does not match the CentOS Version of the CBS tag'.format(attr) + raise AssertionError except AttributeError, e: msg = 'bad cbs tag!'