Permalink
Browse files

add remote REPL

  • Loading branch information...
1 parent 49138c9 commit 2e413314c915ba5feebd5faff3eac6651016a469 @ubolonton ubolonton committed Nov 7, 2011
Showing with 19 additions and 1 deletion.
  1. +19 −1 twisted/plugins/warp_plugin.py
@@ -112,6 +112,7 @@ def makeService(self, options):
if hasattr(configModule, 'startup'):
configModule.startup()
+ # Start a console instead of the site
if options.subCommand == "console":
locals = {'store': runtime.store}
interpreter = options.subOptions.get("interpreter",
@@ -152,7 +153,24 @@ def makeService(self, options):
if hasattr(configModule, 'mungeService'):
service = configModule.mungeService(service)
- return service
+ # Start a remote console if console:port and
+ # console:passwd_file are specified
+ passwd = config.get("console", {}).get("passwd_file")
+ if passwd:
+ from twisted.conch import manhole_tap
+ from twisted.application.service import MultiService
+ manhole = manhole_tap.makeService({
+ "namespace": {"store": runtime.store},
+ "sshPort": "tcp:%s:interface=127.0.0.1" % config["console"]["sshPort"],
+ "telnetPort": "tcp:%s:interface=127.0.0.1" % config["console"]["telnetPort"],
+ "passwd": passwd,
+ })
+
+ ms = MultiService()
+ manhole.setServiceParent(ms)
+ service.setServiceParent(ms)
+ return ms
+ return service
serviceMaker = WarpServiceMaker()

0 comments on commit 2e41331

Please sign in to comment.