blob: 2a165eb0dcde8ae95a7d624c0a623a259ed5b6cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/usr/bin/python3
import os
import re
import configparser
accounts = {}
for dentry in os.walk('.'):
if not re.search('\.git', dentry[0]) and not re.match('^\.$', dentry[0]):
for f in dentry[2]:
conf = configparser.ConfigParser()
conf.read('{}/{}'.format(dentry[0],f))
ei = conf.sections()[0]
# This should raise an exception if there's no accountId
# because that's a huge problem
try:
account_id = conf[ei]['accountid']
except Exception:
print("ERROR: no accountId for %s!!" % ei)
continue
if account_id not in accounts:
accounts[account_id] = {}
exp = re.match('externalId "(?P<id_pat>.+)"', ei)
if not exp:
print("Unidentified ID: %s" % exp)
(auth_type,target) = re.split(':', exp.group('id_pat'))
accounts[account_id][auth_type] = target
for k in conf[ei]:
if k not in accounts[account_id]:
accounts[account_id][k] = []
accounts[account_id][k].append(conf[ei][k])
for k in accounts:
if 'github-oauth' not in accounts[k]:
print("WARNING: no github-oauth found for account %s (%s)" % (k, accounts[k]['username']))
if 'mailto' in accounts[k]:
if accounts[k]['mailto'] not in accounts[k]['email']:
print("WARNING: mailto not set as email for account %s - %s" % (k,accounts[k]['mailto']))
if 'username' not in accounts[k]:
print("WARNING: no username for account %s" % k)
|