Merge "Basic validation for gerritbot/channels.yaml"
This commit is contained in:
commit
ca4e56665c
@ -33,7 +33,27 @@ def access_gerrit_check():
|
||||
|
||||
gerrit_config = yaml.load(open('gerritbot/channels.yaml'))
|
||||
|
||||
print("Checking that all channels in gerritbot are also in accessbot")
|
||||
print("Basic check of gerritbot/channels.yaml")
|
||||
REQUIRED_ENTRIES=("branches", "events", "projects")
|
||||
VALID_EVENTS=("change-merged", "patchset-created", "x-vrif-minus-2")
|
||||
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'"
|
||||
% (entry, channel))
|
||||
errors = True
|
||||
elif not gerrit_config[channel][entry]:
|
||||
print(" 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"
|
||||
% (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)
|
||||
|
Loading…
Reference in New Issue
Block a user