Support querying for single group info

Allow querying to check if a single group entry exists, which when
combined with 'verbose=True' will return the UUID for a single group.

Change-Id: I851ab29999c0d059c9cb71bd38a821c035ae98f7
This commit is contained in:
Darragh Bailey 2016-12-19 17:05:16 +00:00 committed by Darragh Bailey (electrofelix)
parent 500c8d2cc9
commit a731676fd1
1 changed files with 10 additions and 0 deletions

View File

@ -309,6 +309,16 @@ class Gerrit(object):
out, err = self._ssh(cmd)
return filter(None, out.split('\n'))
def listGroup(self, group, verbose=False):
if verbose:
cmd = 'gerrit ls-groups -v'
else:
cmd = 'gerrit ls-groups'
# ensure group names with spaces are escaped and quoted
group = "\"%s\"" % group.replace(' ', '\ ')
out, err = self._ssh(' '.join([cmd, '-q', group]))
return filter(None, out.split('\n'))
def listPlugins(self):
plugins = self.getPlugins()
plugin_names = plugins.keys()