More python3 fixes

Return strings from run_command

jeepyb is written expecting strings. Decode the bytes into a
string.

Fix fsck_command for python3

We fixed run_command to return strings, but fsck_command was
looking for bytes.

Filter returns an interator not a list in python3, wrap in a
list.

Change-Id: Ibb4d540a987711bd6b4c804a3f6b7cb2ccfe1baa
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 55a0bde..fb4aec9 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -198,7 +198,7 @@
     Wait for up to 10 seconds for the group to be created in the DB.
     """
     for x in range(retries):
-        group_list = gerrit.listGroup(group, verbose=True)
+        group_list = list(gerrit.listGroup(group, verbose=True))
         if group_list:
             return group_list[0].split('\t')[1]
         if retries > 1:
@@ -213,7 +213,7 @@
     if group in GERRIT_SYSTEM_GROUPS:
         return GERRIT_SYSTEM_GROUPS[group]
     gerrit.createGroup(group)
-    for user in gerrit.listMembers(group):
+    for user in list(gerrit.listMembers(group)):
         if gerrit.username == user['username']:
             # Gerrit now adds creating user to groups. We don't want that.
             gerrit.removeMember(group, gerrit.username)
@@ -464,7 +464,7 @@
                                      GERRIT_USER,
                                      GERRIT_PORT,
                                      GERRIT_KEY)
-    project_list = gerrit.listProjects()
+    project_list = list(gerrit.listProjects())
     ssh_env = u.make_ssh_wrapper(GERRIT_USER, GERRIT_KEY)
     try:
         # Collect processed errors,if any
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index ef6cfef..9d50479 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -52,6 +52,7 @@
     p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT, env=newenv)
     (out, nothing) = p.communicate()
+    out = out.decode('utf-8')
     log.debug("Return code: %s" % p.returncode)
     log.debug("Command said: %s" % out.strip())
     if status:
@@ -171,7 +172,7 @@
     # Check for non zero return code or warnings which should
     # be treated as errors. In this case zeroPaddedFilemodes
     # will not be accepted by Gerrit/jgit but are accepted by C git.
-    if rc != 0 or b'zeroPaddedFilemode' in out:
+    if rc != 0 or 'zeroPaddedFilemode' in out:
         log.error('git fsck of %s failed:\n%s' % (repo_path, out))
         raise Exception('git fsck failed not importing')