From fb041565da925de3aa966ecd89ffb3cf2eaabb71 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 4 Dec 2012 14:31:50 -0800 Subject: [PATCH] Remove dangerous dbQuery method. Running DB queries over an SSH connection got gerrit gsql requires a lot of overhead to do sanely. Remove this method to avoid abuse and the need to support it. gerritlib users should use a dbapi implementation for the DB backing gerrit to perform DB queries directly. Change-Id: I4f9449b5546a3714a79172c57ea6086c7707f86a --- gerritlib/gerrit.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/gerritlib/gerrit.py b/gerritlib/gerrit.py index efa4214..affb91a 100644 --- a/gerritlib/gerrit.py +++ b/gerritlib/gerrit.py @@ -160,22 +160,6 @@ class Gerrit(object): pprint.pformat(data))) return data - def dbQuery(self, query): - cmd = 'gerrit gsql --format JSON -c "%s"' % query - out, err = self._ssh(cmd) - if not out: - return False - lines = out.strip().split('\n') - if not lines: - return False - data = map(json.loads, lines) - if not data: - return False - self.log.debug("Received %s rows from Gerrit DB query: \n%s" % ( - # Subtract one for query states line. - (len(data) - 1), query)) - return data - def _ssh(self, command): client = paramiko.SSHClient() client.load_system_host_keys()