← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/turnip:py3-server-scripts into turnip:master

 

Thiago F. Pappacena has proposed merging ~pappacena/turnip:py3-server-scripts into turnip:master.

Commit message:
Making startup scripts compatible with python3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/turnip/+git/turnip/+merge/394663
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/turnip:py3-server-scripts into turnip:master.
diff --git a/sshserver.tac b/sshserver.tac
index aaf8220..0875c84 100644
--- a/sshserver.tac
+++ b/sshserver.tac
@@ -12,6 +12,7 @@ from __future__ import (
 
 import os
 
+import six
 from twisted.application import service
 from twisted.scripts.twistd import ServerOptions
 
@@ -26,14 +27,15 @@ def getSmartSSHService():
 
     return SmartSSHService(
         config.get('pack_virt_host'), int(config.get('pack_virt_port')),
-        config.get('authentication_endpoint'),
+        six.ensure_binary(config.get('authentication_endpoint')),
         private_key_path=config.get('private_ssh_key_path'),
         public_key_path=config.get('public_ssh_key_path'),
         # XXX cjwatson 2015-04-25: Should we just send access log
         # information to the main log?  Requires lazr.sshserver changes.
         main_log='turnip', access_log=os.path.join(log_path, 'turnip.access'),
         access_log_path=os.path.join(log_path, 'turnip-access.log'),
-        strport=b'tcp:{}'.format(int(config.get('smart_ssh_port'))),
+        strport=six.ensure_str(
+            'tcp:{}'.format(int(config.get('smart_ssh_port')))),
         moduli_path=config.get('moduli_path'))
 
 
diff --git a/turnipserver.py b/turnipserver.py
index 08fc987..15cc950 100644
--- a/turnipserver.py
+++ b/turnipserver.py
@@ -9,6 +9,7 @@ from __future__ import (
 
 import os
 
+import six
 import statsd
 from twisted.internet import reactor
 from twisted.web import server
@@ -77,12 +78,13 @@ reactor.listenTCP(int(config.get('pack_frontend_port')),
 smarthttp_site = server.Site(SmartHTTPFrontendResource(config))
 reactor.listenTCP(int(config.get('smart_http_port')), smarthttp_site)
 smartssh_service = SmartSSHService(
-    PACK_VIRT_HOST, PACK_VIRT_PORT, config.get('authentication_endpoint'),
+    PACK_VIRT_HOST, PACK_VIRT_PORT,
+    six.ensure_binary(config.get('authentication_endpoint')),
     private_key_path=config.get('private_ssh_key_path'),
     public_key_path=config.get('public_ssh_key_path'),
     main_log='turnip', access_log=os.path.join(LOG_PATH, 'turnip.access'),
     access_log_path=os.path.join(LOG_PATH, 'turnip-access.log'),
-    strport=b'tcp:{}'.format(int(config.get('smart_ssh_port'))),
+    strport=six.ensure_str('tcp:{}'.format(int(config.get('smart_ssh_port')))),
     moduli_path=config.get('moduli_path'))
 smartssh_service.startService()