Make gerrit port configurable.

Change-Id: Idf87910a9f82556f247e0232468f2f883d718f97
Reviewed-on: https://review.openstack.org/33927
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 8da04a9..d455e0f 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -296,6 +296,7 @@
     LOCAL_GIT_DIR = defaults.get('local-git-dir', '/var/lib/git')
     ACL_DIR = defaults.get('acl-dir')
     GERRIT_HOST = defaults.get('gerrit-host')
+    GERRIT_PORT = defaults.get('gerrit-port', '29418')
     GERRIT_USER = defaults.get('gerrit-user')
     GERRIT_KEY = defaults.get('gerrit-key')
     GERRIT_GITID = defaults.get('gerrit-committer')
@@ -304,7 +305,7 @@
 
     gerrit = gerritlib.gerrit.Gerrit('localhost',
                                      GERRIT_USER,
-                                     29418,
+                                     GERRIT_PORT,
                                      GERRIT_KEY)
     project_list = gerrit.listProjects()
     ssh_env = make_ssh_wrapper(GERRIT_USER, GERRIT_KEY)
@@ -324,7 +325,7 @@
                 create_github_project(defaults, options, project,
                                       description, homepage)
 
-            remote_url = "ssh://localhost:29418/%s" % project
+            remote_url = "ssh://localhost:%s/%s" % (GERRIT_PORT, project)
             if project not in project_list:
                 tmpdir = tempfile.mkdtemp()
                 try:
@@ -345,9 +346,9 @@
                                   'w') as gitreview:
                             gitreview.write("""[gerrit]
 host=%s
-port=29418
+port=%s
 project=%s
-""" % (GERRIT_HOST, project_git))
+""" % (GERRIT_HOST, GERRIT_PORT, project_git))
                         git_command(repo_path, "add .gitreview")
                         cmd = ("commit -a -m'Added .gitreview' --author='%s'"
                                % GERRIT_GITID)