You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2015/07/27 15:02:29 UTC
svn commit: r1692877 - in /qpid/dispatch/trunk/python:
qpid_dispatch/management/qdrouter.json
qpid_dispatch_internal/management/agent.py
Author: eallen
Date: Mon Jul 27 13:02:29 2015
New Revision: 1692877
URL: http://svn.apache.org/r1692877
Log:
DISPATCH-151: Add console entity to run a proxy/web server
Modified:
qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py
Modified: qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json?rev=1692877&r1=1692876&r2=1692877&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json Mon Jul 27 13:02:29 2015
@@ -887,6 +887,20 @@
}
},
+ "console": {
+ "description": "Start a websocket/tcp proxy and http file server to serve the web console",
+ "extends": "configurationEntity",
+ "singleton": true,
+ "attributes": {
+ "listener": {"type": "string", "description": "The name of the listener to send the proxied tcp traffic to."},
+ "wsport": {"type": "integer", "description": "port on which to listen for websocket traffic", "default": 5673},
+ "proxy": {"type": "string", "description": "The full path to the proxy program to run."},
+ "home": {"type": "string", "description": "The full path to the html/css/js files for the console."},
+ "args": {"type": "string", "description": "Optional args to pass the proxy program for logging, authentication, etc."}
+
+ }
+ },
+
"dummy": {
"description": "Dummy entity for test purposes.",
"extends": "entity",
Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py?rev=1692877&r1=1692876&r2=1692877&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py Mon Jul 27 13:02:29 2015
@@ -72,6 +72,7 @@ from threading import Lock
from cProfile import Profile
from cStringIO import StringIO
from ctypes import c_void_p, py_object, c_long
+from subprocess import Popen
from ..dispatch import IoAdapter, LogAdapter, LOG_INFO, LOG_DEBUG, LOG_ERROR
from qpid_dispatch.management.error import ManagementError, OK, CREATED, NO_CONTENT, STATUS_TEXT, \
BadRequestStatus, InternalServerErrorStatus, NotImplementedStatus, NotFoundStatus
@@ -300,6 +301,38 @@ class LinkRoutePatternEntity(EntityAdapt
def create(self):
self._qd.qd_dispatch_configure_lrp(self._dispatch, self)
+class ConsoleEntity(EntityAdapter):
+ def create(self):
+ # if a named listener is present, use its addr:port
+ name = self.attributes.get('listener')
+ if name:
+ listeners = self._agent.find_entity_by_type("listener")
+ for listener in listeners:
+ if listener.name == name:
+ try:
+ #required
+ host = listener.attributes['addr']
+ port = listener.attributes['port']
+ wsport = self.attributes['wsport']
+ #optional
+ home = self.attributes.get('home')
+ args = self.attributes.get('args')
+
+ pargs = []
+ pargs.append(self.attributes['proxy'])
+ pargs.append(str(self.attributes['wsport']))
+ pargs.append("%s:%s" % (host, port))
+ if home:
+ pargs.append("--web")
+ pargs.append(self.attributes['home'])
+ if args:
+ pargs.append(args)
+
+ #run the external program
+ Popen(pargs)
+ except:
+ self._agent.log(LOG_ERROR, "Can't parse console entity: %s" % (format_exc()))
+ break
class DummyEntity(EntityAdapter):
def callme(self, request):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org