From dd0211ab8532c6a4e07314ac844501ef34f0c148 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 1 Jun 2015 13:06:08 -0400 Subject: [PATCH] Stop hard coding core team member lists All of the project json files had lists of the core review team members. Since this was originally written, gerrit has added a REST API and this information is available through that API. Get the info from there instead when we can. There are a few project files I didn't convert because the equivalent gerrit team wasn't immediately obvious. Change-Id: Ie7ae19d9a58a5148002676604fd6962ea1438786 Signed-off-by: Russell Bryant --- genresults-reviewers.sh | 4 ++++ projects/barbican.json | 7 +------ projects/ceilometer.json | 9 ++++++++- projects/cinder.json | 10 ++++++++- projects/devstack.json | 12 +---------- projects/docs-specs.json | 7 +------ projects/docs.json | 18 +---------------- projects/fuel.json | 13 +----------- projects/glance.json | 10 ++++++++- projects/grenade.json | 5 +---- projects/heat.json | 15 +------------- projects/horizon.json | 15 +------------- projects/infra.json | 12 +++-------- projects/ironic-discoverd.json | 14 ++++++------- projects/ironic-specs.json | 17 +++++++--------- projects/ironic.json | 26 +++++++++--------------- projects/jjb.json | 19 +++++++---------- projects/keystone.json | 14 +------------ projects/magnetodb.json | 6 +----- projects/mistral.json | 4 +--- projects/murano.json | 8 +------- projects/neutron.json | 17 +--------------- projects/nova-specs.json | 9 +-------- projects/nova.json | 17 +--------------- projects/oslo.json | 13 +----------- projects/oslo.messaging.json | 12 +---------- projects/qa-specs.json | 12 +---------- projects/requirements.json | 30 +++++++-------------------- projects/rubick.json | 5 +---- projects/sahara.json | 11 +--------- projects/security-doc.json | 10 +-------- projects/solum.json | 10 +-------- projects/stable.json | 28 +------------------------ projects/storyboard.json | 9 +-------- projects/swift.json | 10 ++++++++- projects/taskflow.json | 9 +-------- projects/tempest.json | 12 +---------- projects/training-guides.json | 8 +------- projects/tripleo.json | 26 +++--------------------- projects/trove.json | 12 +---------- requirements.txt | 1 + reviewstats/cmd/reviewers.py | 16 ++++++++++----- reviewstats/utils.py | 37 ++++++++++++++++++++++++++++++++-- 43 files changed, 157 insertions(+), 402 deletions(-) diff --git a/genresults-reviewers.sh b/genresults-reviewers.sh index 95de05d..4767514 100755 --- a/genresults-reviewers.sh +++ b/genresults-reviewers.sh @@ -16,6 +16,10 @@ if [ -n "${GERRIT_USER}" ] ; then EXTRA_ARGS="-u ${GERRIT_USER}" fi +if [ -n "${GERRIT_PASS}" ] ; then + EXTRA_ARGS="-P ${GERRIT_PASS}" +fi + if [ -n "${GERRIT_KEY}" ] ; then EXTRA_ARGS="${EXTRA_ARGS} -k ${GERRIT_KEY}" fi diff --git a/projects/barbican.json b/projects/barbican.json index c14f5d3..3bf51b7 100644 --- a/projects/barbican.json +++ b/projects/barbican.json @@ -4,10 +4,5 @@ "subprojects": [ "stackforge/barbican" ], - "core-team": [ - "dougmendizabal", - "woodster", - "reaperhulk", - "john.vrbanac" - ] + "core-team-gerrit-group": "barbican-core" } diff --git a/projects/ceilometer.json b/projects/ceilometer.json index f093c71..c843914 100644 --- a/projects/ceilometer.json +++ b/projects/ceilometer.json @@ -1 +1,8 @@ -{"name": "ceilometer", "subprojects": ["openstack/ceilometer", "openstack/python-ceilometerclient"], "core-team": ["jdanjou", "doug-hellmann", "chungg", "lianhao-lu", "asalkeld", "eglynn", "nijaba", "corvus", "ildikov", "nprivalova"]} +{ + "name": "ceilometer", + "subprojects": [ + "openstack/ceilometer", + "openstack/python-ceilometerclient" + ], + "core-team-gerrit-group": "ceilometer-core" +} diff --git a/projects/cinder.json b/projects/cinder.json index 68f35cb..6fba9cb 100644 --- a/projects/cinder.json +++ b/projects/cinder.json @@ -1 +1,9 @@ -{"name": "cinder", "subprojects": ["openstack/cinder", "openstack/python-cinderclient", "openstack/volume-api"], "core-team": ["john-griffith", "avishay-il", "zhiteng-huang", "eharney", "duncan-thomas", "thingee", "walter-boring", "jdurgin", "jsbryant"]} +{ + "name": "cinder", + "subprojects": [ + "openstack/cinder", + "openstack/python-cinderclient", + "openstack/volume-api" + ], + "core-team-gerrit-group": "cinder-core" +} diff --git a/projects/devstack.json b/projects/devstack.json index 43abb85..f6238e0 100644 --- a/projects/devstack.json +++ b/projects/devstack.json @@ -1,15 +1,5 @@ { "name": "devstack", "subprojects": ["openstack-dev/devstack"], - "core-team": [ - "sdague", - "dtroyer", - "garyk", - "danwent", - "anotherjesse", - "vishvananda", - "corvus", - "bcwaldon", - "termie" - ] + "core-team-gerrit-group": "devstack-core" } diff --git a/projects/docs-specs.json b/projects/docs-specs.json index b4f7ad0..bd0f91a 100644 --- a/projects/docs-specs.json +++ b/projects/docs-specs.json @@ -3,10 +3,5 @@ "subprojects": [ "openstack/docs-specs" ], - "core-team": [ - "annegentle", - "bdpayne", - "jaegerandi", - "sroberts" - ] + "core-team-gerrit-group": "openstack-doc-specs-core" } diff --git a/projects/docs.json b/projects/docs.json index d69f5d1..6d7e0aa 100644 --- a/projects/docs.json +++ b/projects/docs.json @@ -7,21 +7,5 @@ "openstack/openstack-doc-tools", "openstack/openstackdocstheme" ], - "core-team": [ - "Alexander", - "annegentle", - "bdpayne", - "berendt", - "diane-fleming", - "fifieldt", - "gpocentek", - "ionosphere80", - "jaegerandi", - "loquacity", - "mzlatkova", - "Olga", - "sgordon", - "shillasaebi", - "slong" - ] + "core-team-gerrit-group": "openstack-doc-core" } diff --git a/projects/fuel.json b/projects/fuel.json index 5897d30..1e41d32 100644 --- a/projects/fuel.json +++ b/projects/fuel.json @@ -11,16 +11,5 @@ "stackforge/fuel-ostf", "stackforge/fuel-provision" ], - "core-team": [ - "mihgen", - "NastyaUrlapova", - "evgeniyl", - "aleksey", - "r0mikiam", - "vkramskikh", - "aglarendil", - "dpyzhov", - "tatyana-leontovich", - "angdraug" - ] + "core-team-gerrit-group": "fuel-core" } diff --git a/projects/glance.json b/projects/glance.json index 6a644bd..4e393ad 100644 --- a/projects/glance.json +++ b/projects/glance.json @@ -1 +1,9 @@ -{"name": "glance", "subprojects": ["openstack/glance", "openstack/python-glanceclient", "openstack/image-api"], "core-team": ["markwash", "bcwaldon", "eglynn", "dan-prince", "flaper87", "alex-meade", "jbresnah", "iccha-sethi", "flwang", "lzy-dev"]} +{ + "name": "glance", + "subprojects": [ + "openstack/glance", + "openstack/python-glanceclient", + "openstack/image-api" + ], + "core-team-gerrit-group": "glance-core" +} diff --git a/projects/grenade.json b/projects/grenade.json index c982877..61e74b6 100644 --- a/projects/grenade.json +++ b/projects/grenade.json @@ -1,8 +1,5 @@ { "name": "grenade", "subprojects": ["openstack-dev/grenade"], - "core-team": [ - "sdague", - "dtroyer" - ] + "core-team-gerrit-group": "grenade-core" } diff --git a/projects/heat.json b/projects/heat.json index 1570899..04a1afd 100644 --- a/projects/heat.json +++ b/projects/heat.json @@ -6,18 +6,5 @@ "openstack/heat-cfntools", "openstack/python-heatclient" ], - "core-team": [ - "asalkeld", - "huangtianhua", - "jbd", - "pshchelo", - "randall-burt", - "steve-stevebaker", - "shardy", - "skraynev", - "tengqm", - "therve", - "thomasspatzier", - "zaneb" - ] + "core-team-gerrit-group": "heat-core" } diff --git a/projects/horizon.json b/projects/horizon.json index b8bd1a9..b2540d8 100644 --- a/projects/horizon.json +++ b/projects/horizon.json @@ -4,18 +4,5 @@ "openstack/horizon", "openstack/tripleo-ui" ], - "core-team": [ - "akrivoka", - "amotoki", - "clu-m", - "david-lyle", - "jpichon", - "lin-hua-cheng", - "mrunge", - "niu-zglinux", - "thesheep", - "tmazur", - "tqtran", - "ttrifonov" - ] + "core-team-gerrit-group": "horizon-core" } diff --git a/projects/infra.json b/projects/infra.json index 7ea2b27..33cd281 100644 --- a/projects/infra.json +++ b/projects/infra.json @@ -115,12 +115,6 @@ "openstack-infra/zuul", "openstack-infra/zuul-packaging", "openstack/openstack-planet" -], "core-team": [ - "cboylan", - "corvus", - "fungi", - "jhesketh", - "lyz", - "mordred", - "slukjanov" -]} +], + "core-team-gerrit-group": "infra-core" +} diff --git a/projects/ironic-discoverd.json b/projects/ironic-discoverd.json index 03e07c6..e61c74c 100644 --- a/projects/ironic-discoverd.json +++ b/projects/ironic-discoverd.json @@ -1,7 +1,7 @@ -{"name": "ironic-discoverd", "subprojects": [ - "stackforge/ironic-discoverd" -], "core-team": [ - "lucasagomes", - "ifarkas", - "dtantsur" -]} +{ + "name": "ironic-discoverd", + "subprojects": [ + "stackforge/ironic-discoverd" + ], + "core-team-gerrit-group": "ironic-discoverd-core" +} diff --git a/projects/ironic-specs.json b/projects/ironic-specs.json index cb80150..3bf67f2 100644 --- a/projects/ironic-specs.json +++ b/projects/ironic-specs.json @@ -1,10 +1,7 @@ -{"name": "ironic-specs", "subprojects": [ - "openstack/ironic-specs" -], "core-team": [ - "devananda", - "nobodycam", - "lucasagomes", - "dtantsur", - "JayF", - "jimrollenhagen" -]} +{ + "name": "ironic-specs", + "subprojects": [ + "openstack/ironic-specs" + ], + "core-team-gerrit-group": "ironic-specs-core" +} diff --git a/projects/ironic.json b/projects/ironic.json index 8ee9dd2..ece1282 100644 --- a/projects/ironic.json +++ b/projects/ironic.json @@ -1,17 +1,9 @@ -{"name": "ironic", "subprojects": [ - "openstack/ironic", - "openstack/python-ironicclient", - "openstack/ironic-python-agent" -], "core-team": [ - "devananda", - "lucasagomes", - "nobodycam", - "JayF", - "jimrollenhagen", - "rloo", - "yuriyz", - "whaom", - "dtantsur", - "dshrews", - "JoshNang" -]} +{ + "name": "ironic", + "subprojects": [ + "openstack/ironic", + "openstack/python-ironicclient", + "openstack/ironic-python-agent" + ], + "core-team-gerrit-group": "ironic-core" +} diff --git a/projects/jjb.json b/projects/jjb.json index 9d677a2..ad279c2 100644 --- a/projects/jjb.json +++ b/projects/jjb.json @@ -1,12 +1,7 @@ -{"name": "jjb", "subprojects": [ - "openstack-infra/jenkins-job-builder" -], "core-team": [ - "arnaud.fabre", - "cboylan", - "corvus", - "fungi", - "hashar", - "mgagne", - "mordred", - "zaro0508" -]} +{ + "name": "jjb", + "subprojects": [ + "openstack-infra/jenkins-job-builder" + ], + "core-team-gerrit-group": "jenkins-job-builder-core" +} diff --git a/projects/keystone.json b/projects/keystone.json index ae86164..5742f3e 100644 --- a/projects/keystone.json +++ b/projects/keystone.json @@ -9,18 +9,6 @@ "openstack/python-keystoneclient-kerberos", "openstack/identity-api" ], - "core-team": [ - "ayoung", - "blk-u", - "dolph", - "dstanek", - "guang-yee", - "henry-nash", - "jamielennox", - "ldbragst", - "marek-denis", - "mdrnstm", - "stevemar" - ] + "core-team-gerrit-group": "keystone-core" } diff --git a/projects/magnetodb.json b/projects/magnetodb.json index 4f84666..60da8a6 100644 --- a/projects/magnetodb.json +++ b/projects/magnetodb.json @@ -4,9 +4,5 @@ "subprojects": [ "stackforge/magnetodb" ], - "core-team": [ - "isviridov", - "dukhlov", - "ikhudoshyn" - ] + "core-team-gerrit-group": "magnetodb-core" } diff --git a/projects/mistral.json b/projects/mistral.json index 99b5752..43b2c44 100644 --- a/projects/mistral.json +++ b/projects/mistral.json @@ -6,7 +6,5 @@ "stackforge/mistral-extra", "stackforge/python-mistralclient" ], - "core-team": [ - "rakhmerov" - ] + "core-team-gerrit-group": "mistral-core" } diff --git a/projects/murano.json b/projects/murano.json index 229143e..65e6c40 100644 --- a/projects/murano.json +++ b/projects/murano.json @@ -9,11 +9,5 @@ "stackforge/murano-docs", "stackforge/python-muranoclient" ], - "core-team": [ - "ativelkov", - "dteselkin", - "tsufiev", - "istalker2", - "ruhe" - ] + "core-team-gerrit-group": "murano-core" } diff --git a/projects/neutron.json b/projects/neutron.json index 4252620..31826ae 100644 --- a/projects/neutron.json +++ b/projects/neutron.json @@ -9,20 +9,5 @@ "openstack/netconn-api", "openstack/neutron-specs" ], - "core-team": [ - "arosen", - "amotoki", - "armando-migliaccio", - "carl-baldwin", - "dougw", - "emagana", - "garyk", - "HenryG", - "kevinbenton", - "markmcclain", - "maru", - "mestery", - "obondarev", - "salvatore-orlando" - ] + "core-team-gerrit-group": "neutron-core" } diff --git a/projects/nova-specs.json b/projects/nova-specs.json index dee675f..abb9554 100644 --- a/projects/nova-specs.json +++ b/projects/nova-specs.json @@ -3,12 +3,5 @@ "subprojects": [ "openstack/nova-specs" ], - "core-team": [ - "alaski", - "berrange", - "danms", - "jogo", - "johngarbutt", - "mikalstill" - ] + "core-team-gerrit-group": "nova-specs-core" } diff --git a/projects/nova.json b/projects/nova.json index 2cbdf17..eb3774c 100644 --- a/projects/nova.json +++ b/projects/nova.json @@ -6,21 +6,6 @@ "openstack/python-novaclient", "openstack/compute-api" ], - "core-team": [ - "alaski", - "berrange", - "cerberus", - "danms", - "jaypipes", - "jogo", - "johngarbutt", - "klmitch", - "mikalstill", - "melwitt", - "mriedem", - "ndipanov", - "oomichi", - "sdague" - ], + "core-team-gerrit-group": "nova-core", "lp_projects": ["nova", "python-novaclient"] } diff --git a/projects/oslo.json b/projects/oslo.json index 98d2a33..7db673d 100644 --- a/projects/oslo.json +++ b/projects/oslo.json @@ -22,16 +22,5 @@ "openstack/taskflow", "openstack/requirements" ], - "core-team": [ - "bnemec", - "dims-v", - "doug-hellmann", - "flaper87", - "haypo", - "jdanjou", - "markmc", - "mikalstill", - "russellb", - "zyluo" - ] + "core-team-gerrit-group": "oslo-core" } diff --git a/projects/oslo.messaging.json b/projects/oslo.messaging.json index 37c1125..44ef224 100644 --- a/projects/oslo.messaging.json +++ b/projects/oslo.messaging.json @@ -3,15 +3,5 @@ "subprojects": [ "openstack/oslo.messaging" ], - "core-team": [ - "bnemec", - "dims-v", - "doug-hellmann", - "flaper87", - "jdanjou", - "markmc", - "mikalstill", - "russellb", - "zyluo" - ] + "core-team-gerrit-group": "oslo-messaging-core" } diff --git a/projects/qa-specs.json b/projects/qa-specs.json index f1d393b..8887258 100644 --- a/projects/qa-specs.json +++ b/projects/qa-specs.json @@ -1,15 +1,5 @@ { "name": "qa-specs", "subprojects": ["openstack/qa-specs"], - "core-team": [ - "afazekas", - "cyeoh-0", - "andrea-frittoli", - "david-kranz", - "igawa", - "mkoderer", - "oomichi", - "treinish", - "sdague" - ] + "core-team-gerrit-group": "qa-specs-core" } diff --git a/projects/requirements.json b/projects/requirements.json index 900c2d8..5514c65 100644 --- a/projects/requirements.json +++ b/projects/requirements.json @@ -1,24 +1,8 @@ -{"name": "requirements", "subprojects": [ - "openstack/requirements" -], "core-team": [ - "alex_gaynor", - "cboylan", - "corvus", - "dan-prince", - "davewalker", - "doug-hellmann", - "ewindisch", - "fungi", - "gabriel-hurley", - "ghe.rivero", - "heckj", - "jdanjou", - "markmc", - "markmcclain", - "mordred", - "sdague", - "slukjanov", - "ttx", - "zulcss" -]} +{ + "name": "requirements", + "subprojects": [ + "openstack/requirements" + ], + "core-team-gerrit-group": "requirements-core" +} diff --git a/projects/rubick.json b/projects/rubick.json index 8a13be5..5808f5a 100644 --- a/projects/rubick.json +++ b/projects/rubick.json @@ -4,8 +4,5 @@ "subprojects": [ "stackforge/rubick" ], - "core-team": [ - "mkulkin", - "gelbuhos" - ] + "core-team-gerrit-group": "rubick-core" } diff --git a/projects/sahara.json b/projects/sahara.json index 82d1e14..5b31d33 100644 --- a/projects/sahara.json +++ b/projects/sahara.json @@ -8,14 +8,5 @@ "openstack/sahara-image-elements", "stackforge/puppet-sahara" ], - "core-team": [ - "slukjanov", - "aignatov", - "farrellee", - "jspeidel", - "alazarev", - "tmckay", - "mimccune", - "sreshetniak" - ] + "core-team-gerrit-group": "sahara-core" } diff --git a/projects/security-doc.json b/projects/security-doc.json index ea02893..4c28b7a 100644 --- a/projects/security-doc.json +++ b/projects/security-doc.json @@ -3,13 +3,5 @@ "subprojects": [ "openstack/security-doc" ], - "core-team": [ - "annegentle", - "bdpayne", - "berendt", - "hyakuhei", - "jaegerandi", - "sicarie", - "nkinder" - ] + "core-team-gerrit-group": "security-doc-core" } diff --git a/projects/solum.json b/projects/solum.json index 3ffe7bc..5414069 100644 --- a/projects/solum.json +++ b/projects/solum.json @@ -5,13 +5,5 @@ "stackforge/solum", "stackforge/python-solumclient" ], - "core-team": [ - "aotto", - "lifeless", - "noorul", - "asalkeld", - "devdatta-kulkarni", - "gokrokve", - "julienvey" - ] + "core-team-gerrit-group": "solum-core" } diff --git a/projects/stable.json b/projects/stable.json index eac6d71..c7cce01 100644 --- a/projects/stable.json +++ b/projects/stable.json @@ -12,31 +12,5 @@ "openstack/neutron", "openstack/horizon" ], - "core-team": [ - "arosen", - "gandelman-a", - "apevec", - "zulcss", - "danms", - "davewalker", - "david-lyle", - "dolph", - "doug-hellmann", - "eglynn", - "flaper87", - "gabriel-hurley", - "john-griffith", - "jdanjou", - "markmc", - "markwash", - "treinish", - "mrunge", - "russellb", - "stevebaker", - "shardy", - "vishvananda", - "garyk", - "markmcclain", - "p-draigbrady" - ] + "core-team-gerrit-group": "stable-maint-core" } diff --git a/projects/storyboard.json b/projects/storyboard.json index 9bfc6a5..8e17644 100644 --- a/projects/storyboard.json +++ b/projects/storyboard.json @@ -4,12 +4,5 @@ "openstack-infra/storyboard", "openstack-infra/storyboard-webclient" ], - "core-team": [ - "ttx", - "cboylan", - "fungi", - "corvus", - "mordred", - "krotscheck" - ] + "core-team-gerrit-group": "storyboard-core" } diff --git a/projects/swift.json b/projects/swift.json index 3d493c1..3f330aa 100644 --- a/projects/swift.json +++ b/projects/swift.json @@ -1 +1,9 @@ -{"name": "swift", "subprojects": ["openstack/swift", "openstack/python-swiftclient", "openstack/swift-bench"], "core-team": ["darrellb", "torgomatic", "notmyname", "clay-gerrard", "david-goetz", "redbo", "greglange", "zaitcev", "acoles", "peluse", "mattoliverau", "cschwede"]} +{ + "name": "swift", + "subprojects": [ + "openstack/swift", + "openstack/python-swiftclient", + "openstack/swift-bench" + ], + "core-team-gerrit-group": "swift-core" +} diff --git a/projects/taskflow.json b/projects/taskflow.json index 8f57fa8..7601bd7 100644 --- a/projects/taskflow.json +++ b/projects/taskflow.json @@ -3,12 +3,5 @@ "subprojects": [ "openstack/taskflow" ], - "core-team": [ - "doug-hellmann", - "changbl", - "imelnikov", - "harlowja", - "pran1990", - "dankrause" - ] + "core-team-gerrit-group": "taskflow-core" } diff --git a/projects/tempest.json b/projects/tempest.json index 38b1800..20db35d 100644 --- a/projects/tempest.json +++ b/projects/tempest.json @@ -1,15 +1,5 @@ { "name": "tempest", "subprojects": ["openstack/tempest"], - "core-team": [ - "afazekas", - "cyeoh-0", - "andrea-frittoli", - "david-kranz", - "igawa", - "mkoderer", - "oomichi", - "treinish", - "sdague" - ] + "core-team-gerrit-group": "tempest-core" } diff --git a/projects/training-guides.json b/projects/training-guides.json index 06aaa52..0665f50 100644 --- a/projects/training-guides.json +++ b/projects/training-guides.json @@ -3,11 +3,5 @@ "subprojects": [ "openstack/training-guides" ], - "core-team": [ - "colinmcnamara", - "dguitarbite", - "rluethi", - "matjazp", - "seanrob" - ] + "core-team-gerrit-group": "openstack-training-guides-core" } diff --git a/projects/tripleo.json b/projects/tripleo.json index 21fc3ec..9d9c99e 100644 --- a/projects/tripleo.json +++ b/projects/tripleo.json @@ -15,29 +15,9 @@ "openstack/tripleo-incubator", "openstack/tripleo-specs", "openstack/tuskar" -], "core-team": [ - "bnemec", - "clint-fewbar", - "cmsj", - "derekh", - "dan-prince", - "ghe.rivero", - "greghaynes", - "jdob", - "jistr", - "jonpaul-sullivan", - "jprovazn", - "lsmola", - "lxsli", - "marios", - "mtaylor", - "pblaho", - "rdopieralski", - "slagle", - "stevenk", - "tchaypo", - "tomas-8c8" -], "lp_projects": [ +], + "core-team-gerrit-group": "tripleo-core", +"lp_projects": [ "diskimage-builder", "os-apply-config", "os-cloud-config", diff --git a/projects/trove.json b/projects/trove.json index e66c21a..a190d3a 100644 --- a/projects/trove.json +++ b/projects/trove.json @@ -6,15 +6,5 @@ "openstack/trove-specs", "openstack/python-troveclient" ], - "core-team": [ - "amcreynolds", - "amrith", - "cp16net", - "ekotowski", - "iccha-sethi", - "peterstac", - "slicknik", - "vipuls", - "vkmc" - ] + "core-team-gerrit-group": "trove-core" } diff --git a/requirements.txt b/requirements.txt index 8fad38c..bc08f68 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ pbr>=0.5.21,<1.0 prettytable Babel>=1.3 pytz>=2010h +requests>=2.2.0,!=2.4.0 six>=1.7.0 diff --git a/reviewstats/cmd/reviewers.py b/reviewstats/cmd/reviewers.py index 097fed4..411ce43 100755 --- a/reviewstats/cmd/reviewers.py +++ b/reviewstats/cmd/reviewers.py @@ -47,7 +47,7 @@ def set_defaults(reviewer, reviewers): reviewers[reviewer].setdefault('received', 0) -def process_patchset(project, patchset, reviewers, ts): +def process_patchset(project, patchset, reviewers, ts, options): latest_core_neg_vote = 0 latest_core_pos_vote = 0 @@ -58,7 +58,8 @@ def process_patchset(project, patchset, reviewers, ts): # Only count code reviews. Don't add another for Approved, which # is type 'Approved' or 'Workflow' continue - core_team = utils.get_core_team(project) + core_team = utils.get_core_team(project, options.server, options.user, + options.password) if review['by'].get('username', 'unknown') not in core_team: # Only checking for disagreements from core team members continue @@ -170,7 +171,8 @@ def write_pretty(reviewer_data, file_obj, options, reviewers, projects, if num_reviewers else 0)) file_obj.write('Total reviews by core team: %d (%.1f/day)\n' % ( totals['core'], float(totals['core']) / options.days)) - core_team_size = sum([len(utils.get_core_team(project)) + core_team_size = sum([len(utils.get_core_team(project, options.server, + options.user, options.password)) for project in projects]) file_obj.write('Core team size: %d (avg %.1f reviews/day)\n' % ( core_team_size, @@ -253,6 +255,9 @@ def main(argv=None): help='Number of days to consider') optparser.add_option( '-u', '--user', default=getpass.getuser(), help='gerrit user') + optparser.add_option( + '-P', '--password', default=getpass.getuser(), + help='gerrit HTTP password') optparser.add_option( '-k', '--key', default=None, help='ssh key for gerrit') optparser.add_option( @@ -297,7 +302,7 @@ def main(argv=None): patch_for_change = False first_patchset = True for patchset in change.get('patchSets', []): - process_patchset(project, patchset, reviewers, ts) + process_patchset(project, patchset, reviewers, ts, options) age = utils.get_age_of_patch(patchset, now_ts) if (now_ts - age) > ts: change_stats['patches'] += 1 @@ -326,7 +331,8 @@ def main(argv=None): for k, v in reviewers: in_core_team = False for project in projects: - if v in utils.get_core_team(project): + if v in utils.get_core_team(project, options.server, options.user, + options.password): in_core_team = True break name = '%s%s' % (v, ' **' if in_core_team else '') diff --git a/reviewstats/utils.py b/reviewstats/utils.py index 40c7d5b..85898e8 100644 --- a/reviewstats/utils.py +++ b/reviewstats/utils.py @@ -21,6 +21,8 @@ import glob import json import logging import os +import requests +import requests.auth from six.moves import cPickle as pickle import time @@ -297,5 +299,36 @@ def get_age_of_patch(patch, now_ts): return now_ts - patch['createdOn'] -def get_core_team(project): - return project['core-team'] +TEAM_MEMBERS = {} + + +def get_team_members(team_name, server, user, pw): + global TEAM_MEMBERS + if team_name in TEAM_MEMBERS: + return TEAM_MEMBERS[team_name] + auth = requests.auth.HTTPDigestAuth(user, pw) + groups_request = requests.get('http://%s/a/groups/' % server, auth=auth) + if groups_request.status_code != 200: + raise Exception('Please provide your Gerrit HTTP Password.') + text = groups_request.text + teams = json.loads(text[text.find('{'):]) + text = requests.get('http://%s/a/groups/%s/detail' % (server, + teams[team_name]['id']), auth=auth).text + team = json.loads(text[text.find('{'):]) + members_list = [n['username'] for n in team['members']] + if 'hudson-openstack' in members_list: + # This is a review.openstack.org specific hack. This user is + # automatically included in core teams, but we don't want to include it + # in the stats. + members_list.remove('hudson-openstack') + TEAM_MEMBERS[team_name] = members_list + return members_list + + +def get_core_team(project, server, user, pw): + if 'core-team' in project: + return project['core-team'] + if 'core-team-gerrit-group' in project: + return get_team_members(project['core-team-gerrit-group'], + server, user, pw) + return []