remove extra item from listGroups and listProjects methods

On gerrit 2.4.x and gerrit 2.8 the list returned by the listGroups and listProjects
methods always contains one extra item at the end of the list for example listGroups
returns something like.. ['Administrators', 'Anonymous Users', 'Non-Interactive Users',
'Project Owners','Registered Users', '']

This change removes the last item from the returned list.

Change-Id: I2af52a35ef5bc7fd300b12911fce18faab474222
This commit is contained in:
Khai Do 2014-01-30 22:10:55 -08:00
parent ac865aa175
commit 8f24b9651c
1 changed files with 2 additions and 2 deletions

View File

@ -134,12 +134,12 @@ class Gerrit(object):
def listProjects(self):
cmd = 'gerrit ls-projects'
out, err = self._ssh(cmd)
return out.split('\n')
return filter(None, out.split('\n'))
def listGroups(self):
cmd = 'gerrit ls-groups'
out, err = self._ssh(cmd)
return out.split('\n')
return filter(None, out.split('\n'))
def replicate(self, project='--all'):
cmd = 'gerrit replicate %s' % project