Consistent ERROR messages
Capitalize ERROR for all project-config specific tests, so that errors can found easily. Add missing ERROR marks. Change-Id: I1d7e1077de62945647e0329462016a34eaabd83e
This commit is contained in:
@@ -49,17 +49,19 @@ def check_repo(repo_path):
|
||||
print(" Master branch exists.")
|
||||
else:
|
||||
found_errors += 1
|
||||
print(" Error: No master branch exists")
|
||||
print(" ERROR: No master branch exists")
|
||||
if 'origin/stable' in branches:
|
||||
found_errors += 1
|
||||
print(" A branch named 'stable' exists, this will break future\n")
|
||||
print(" creation of stable/RELEASE branches.\n")
|
||||
print(" Delete the branch on your upstream project.")
|
||||
print(" ERROR: A branch named 'stable' exists, this will"
|
||||
" break future\n"
|
||||
" creation of stable/RELEASEbranches.\n"
|
||||
" Delete the branch on your upstream project.")
|
||||
if 'origin/feature' in branches:
|
||||
found_errors += 1
|
||||
print(" A branch named 'feature' exists, this will break future\n")
|
||||
print(" creation of feature/NAME branches.\n")
|
||||
print(" Delete the branch on your upstream project.")
|
||||
print(" ERROR: A branch named 'feature' exists, this will break "
|
||||
"future\n"
|
||||
" creation of feature/NAME branches.\n"
|
||||
" Delete the branch on your upstream project.")
|
||||
if repo.tags:
|
||||
print(" Found the following tags:")
|
||||
for tag in repo.tags:
|
||||
@@ -105,7 +107,7 @@ def main():
|
||||
if not name:
|
||||
# not a project
|
||||
found_errors += 1
|
||||
print("Error: Entry is not a project %s" % p)
|
||||
print("ERROR: Entry is not a project %s" % p)
|
||||
continue
|
||||
if args.verbose:
|
||||
print('Checking %s' % name)
|
||||
@@ -127,13 +129,13 @@ def main():
|
||||
# sort of job-description (e.g. "foo-devstack-bar") or
|
||||
# a url ("foo.openstack.org")
|
||||
if re.search(r'(?<![-.])\b%s\b' % word, description):
|
||||
print("Error: %s: should be %s" %
|
||||
print("ERROR: %s: should be %s" %
|
||||
(description, should_be))
|
||||
found_errors += 1
|
||||
|
||||
if not description and repo_group in DESCRIPTION_REQUIRED:
|
||||
found_errors += 1
|
||||
print("Error: Project %s has no description" % name)
|
||||
print("ERROR: Project %s has no description" % name)
|
||||
continue
|
||||
# Check upstream URL
|
||||
# Allow git:// and https:// URLs for importing upstream repositories,
|
||||
@@ -155,7 +157,7 @@ def main():
|
||||
break
|
||||
else:
|
||||
found_errors += 1
|
||||
print('Error: Upstream URLs should use a scheme in %s, '
|
||||
print('ERROR: Upstream URLs should use a scheme in %s, '
|
||||
'found %s in %s' %
|
||||
(VALID_SCHEMES, p['upstream'], name))
|
||||
# Check for any wrong entries
|
||||
@@ -165,37 +167,37 @@ def main():
|
||||
break
|
||||
else:
|
||||
found_errors += 1
|
||||
print("Error: Unknown keyword '%s' in project %s" %
|
||||
print("ERROR: Unknown keyword '%s' in project %s" %
|
||||
(entry, name))
|
||||
# Check for valid options
|
||||
for option in p.get('options', []):
|
||||
if not option in VALID_OPTIONS:
|
||||
found_errors += 1
|
||||
print("Error: Unknown option '%s' in project %s" %
|
||||
print("ERROR: Unknown option '%s' in project %s" %
|
||||
(option, name))
|
||||
# Check redundant acl-config
|
||||
acl_config = p.get('acl-config')
|
||||
if acl_config:
|
||||
if acl_config.endswith(name + '.config'):
|
||||
found_errors += 1
|
||||
print("Error: Project %s has redundant acl_config line, "
|
||||
print("ERROR: Project %s has redundant acl_config line, "
|
||||
"remove it." % name)
|
||||
if not acl_config.startswith('/home/gerrit2/acls/'):
|
||||
found_errors += 1
|
||||
print("Error: Project %s has wrong acl_config line, "
|
||||
print("ERROR: Project %s has wrong acl_config line, "
|
||||
"fix the path." % name)
|
||||
acl_file = os.path.join(args.acldir,
|
||||
acl_config[len('/home/gerrit2/acls/'):])
|
||||
if not os.path.isfile(acl_file):
|
||||
found_errors += 1
|
||||
print("Error: Project %s has non existing acl_config line" %
|
||||
print("ERROR: Project %s has non existing acl_config line" %
|
||||
name)
|
||||
else:
|
||||
# Check that default file exists
|
||||
acl_file = os.path.join(args.acldir, name + ".config")
|
||||
if not os.path.isfile(acl_file):
|
||||
found_errors += 1
|
||||
print("Error: Project %s has no default acl-config file" %
|
||||
print("ERROR: Project %s has no default acl-config file" %
|
||||
name)
|
||||
|
||||
if found_errors:
|
||||
|
||||
@@ -39,31 +39,31 @@ def access_gerrit_check():
|
||||
for channel in gerrit_config:
|
||||
for entry in REQUIRED_ENTRIES:
|
||||
if entry not in gerrit_config[channel]:
|
||||
print(" Required entry '%s' not specified for channel '%s'"
|
||||
print("ERROR: Required entry '%s' not specified for channel '%s'"
|
||||
% (entry, channel))
|
||||
errors = True
|
||||
elif not gerrit_config[channel][entry]:
|
||||
print(" Entry '%s' has no content for channel '%s'"
|
||||
print("ERROR: Entry '%s' has no content for channel '%s'"
|
||||
% (entry, channel))
|
||||
errors = True
|
||||
|
||||
for event in gerrit_config[channel]['events']:
|
||||
if event not in VALID_EVENTS:
|
||||
print(" Event '%s' for channel '%s' is invalid"
|
||||
print("ERROR: Event '%s' for channel '%s' is invalid"
|
||||
% (event, channel))
|
||||
errors = True
|
||||
|
||||
print("\nChecking that all channels in gerritbot are also in accessbot")
|
||||
for channel in gerrit_config:
|
||||
if channel not in access_channel_set:
|
||||
print(" %s is missing from accessbot" % channel)
|
||||
print("ERROR: %s is missing from accessbot" % channel)
|
||||
errors = True
|
||||
|
||||
# IRC has a limit of 120 channels that we unfortunately hit with
|
||||
# gerritbot. If we try connect to more, it will not connect to
|
||||
# all. Avoid this situation.
|
||||
if len(gerrit_config) > 120:
|
||||
print ("gerritbot can only handle 120 channels but found %s."
|
||||
print ("ERROR: gerritbot can only handle 120 channels but found %s."
|
||||
% len(gerrit_config))
|
||||
print ("Sorry, we're at our limit and cannot add more for now.")
|
||||
print ("If you want to help set up another instance contact the "
|
||||
|
||||
Reference in New Issue
Block a user