Gerrit ACLs: Check for valid keys
Add check for valid keys to find obvious typos in keys. Fix the one error found in openstack.config. Change-Id: I6a2af22db0b9425372e66dca93498a33a07275e9
This commit is contained in:
parent
5633dab207
commit
4e9f7cf97e
|
@ -1,5 +1,5 @@
|
||||||
[access "refs/for/refs/*"]
|
[access "refs/for/refs/*"]
|
||||||
exclsiveGroupPermissions = Push
|
exclusiveGroupPermissions = Push
|
||||||
push = group Release Managers
|
push = group Release Managers
|
||||||
|
|
||||||
[access "refs/heads/*"]
|
[access "refs/heads/*"]
|
||||||
|
|
|
@ -45,6 +45,29 @@ def tokens(data):
|
||||||
acl = {}
|
acl = {}
|
||||||
out = ''
|
out = ''
|
||||||
|
|
||||||
|
valid_keys = {'abandon',
|
||||||
|
'access',
|
||||||
|
'copyAllScoresOnTrivialRebase',
|
||||||
|
'create',
|
||||||
|
'defaultValue',
|
||||||
|
'exclusiveGroupPermissions',
|
||||||
|
'forgeAuthor',
|
||||||
|
'forgeCommitter',
|
||||||
|
'function',
|
||||||
|
'label-Code-Review',
|
||||||
|
'label-Rollcall-Vote',
|
||||||
|
'label-Workflow',
|
||||||
|
'label-Verified',
|
||||||
|
'mergeContent',
|
||||||
|
'push',
|
||||||
|
'pushMerge',
|
||||||
|
'pushSignedTag',
|
||||||
|
'requireChangeId',
|
||||||
|
'requireContributorAgreement',
|
||||||
|
'state',
|
||||||
|
'value'
|
||||||
|
}
|
||||||
|
|
||||||
if '0' in transformations or not transformations:
|
if '0' in transformations or not transformations:
|
||||||
dry_run = True
|
dry_run = True
|
||||||
else:
|
else:
|
||||||
|
@ -65,6 +88,10 @@ for line in aclfd:
|
||||||
# key=value lines
|
# key=value lines
|
||||||
elif '=' in line:
|
elif '=' in line:
|
||||||
acl[section].append(line)
|
acl[section].append(line)
|
||||||
|
# Check for valid keys
|
||||||
|
key = line.split('=')[0].strip()
|
||||||
|
if key not in valid_keys:
|
||||||
|
raise Exception('Unrecognized key in line: "%s"' % line)
|
||||||
# WTF
|
# WTF
|
||||||
else:
|
else:
|
||||||
raise Exception('Unrecognized line: "%s"' % line)
|
raise Exception('Unrecognized line: "%s"' % line)
|
||||||
|
|
Loading…
Reference in New Issue