diff --git a/stackalytics/processor/default_data_processor.py b/stackalytics/processor/default_data_processor.py index 950b85404..5cf59f20b 100644 --- a/stackalytics/processor/default_data_processor.py +++ b/stackalytics/processor/default_data_processor.py @@ -96,6 +96,7 @@ def _retrieve_project_list_from_gerrit(project_source): 'organization': organization, 'uri': repo_uri, 'releases': [], + 'repo_name': repo, 'gerrit_uri': uri, 'ssh_username': username, 'key_filename': key_filename, diff --git a/stackalytics/processor/rcs.py b/stackalytics/processor/rcs.py index b244a5540..5503a20fc 100644 --- a/stackalytics/processor/rcs.py +++ b/stackalytics/processor/rcs.py @@ -99,13 +99,13 @@ class Gerrit(Rcs): exc_info=True) raise RcsException('Failed to connect to gerrit: %s' % e) - def _get_cmd(self, project_organization, module, branch, age=0, - status=None, limit=PAGE_LIMIT, grab_comments=False): + def _get_cmd(self, repo_name, branch, age=0, status=None, + limit=PAGE_LIMIT, grab_comments=False): cmd = ('gerrit query --all-approvals --patch-sets --format JSON ' - 'project:\'%(ogn)s/%(module)s\' branch:%(branch)s ' + 'project:\'%(repo_name)s\' branch:%(branch)s ' 'limit:%(limit)s age:%(age)ss' % - {'ogn': project_organization, 'module': module, - 'branch': branch, 'limit': limit, 'age': age}) + {'repo_name': repo_name, 'branch': branch, 'limit': limit, + 'age': age}) if status: cmd += ' status:%s' % status if grab_comments: @@ -139,7 +139,7 @@ class Gerrit(Rcs): raise RcsException('Too many SSH errors, aborting. Consider ' 'increasing "gerrit_retry" value') - def _poll_reviews(self, project_organization, module, branch, + def _poll_reviews(self, repo_name, module, branch, last_retrieval_time, status=None, grab_comments=False): age = 0 proceed = True @@ -152,8 +152,7 @@ class Gerrit(Rcs): processed = set() while proceed: - cmd = self._get_cmd(project_organization, module, branch, - age=age, status=status, + cmd = self._get_cmd(repo_name, branch, age=age, status=status, grab_comments=grab_comments) LOG.debug('Executing command: %s', cmd) exec_result = self._exec_command_with_retrial(cmd) @@ -199,7 +198,7 @@ class Gerrit(Rcs): # poll reviews down from top between last_r_t and current_r_t LOG.debug('Poll reviews for module: %s', repo['module']) for review in self._poll_reviews( - repo['organization'], repo['module'], branch, + repo['repo_name'], repo['module'], branch, last_retrieval_time, status=status, grab_comments=grab_comments): yield review diff --git a/stackalytics/tests/unit/test_rcs.py b/stackalytics/tests/unit/test_rcs.py index 7a77f79d9..0dc680e7e 100644 --- a/stackalytics/tests/unit/test_rcs.py +++ b/stackalytics/tests/unit/test_rcs.py @@ -79,7 +79,7 @@ class TestRcs(testtools.TestCase): gerrit = rcs.Gerrit('uri') - repo = dict(organization='openstack', module='nova') + repo = dict(repo_name='openstack/nova', module='nova') branch = 'master' last_retrieval_time = 1444000000 mock_time.return_value = 1444333333 @@ -111,7 +111,7 @@ class TestRcs(testtools.TestCase): gerrit = rcs.Gerrit('uri') - repo = dict(organization='openstack', module='nova') + repo = dict(repo_name='openstack/nova', module='nova') branch = 'master' last_retrieval_time = 1445000000 records = list(gerrit.log(repo, branch, last_retrieval_time, @@ -142,7 +142,7 @@ class TestRcs(testtools.TestCase): gerrit = rcs.Gerrit('uri') - repo = dict(organization='openstack', module='nova') + repo = dict(repo_name='openstack/nova', module='nova') branch = 'master' last_retrieval_time = 1444000000 mock_time.return_value = 1444333333 @@ -172,7 +172,7 @@ class TestRcs(testtools.TestCase): gerrit = rcs.Gerrit('uri') - repo = dict(organization='openstack', module='nova') + repo = dict(repo_name='openstack/nova', module='nova') branch = 'master' last_retrieval_time = 1444000000 mock_time.return_value = 1444333333