mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-28 11:57:37 +00:00
Renome current console to consoleserver and refactor
This commit is contained in:
parent
3a3dbf9f41
commit
a8d0ec4c3c
@ -14,21 +14,6 @@ import random
|
||||
|
||||
_handled_consoles = {}
|
||||
|
||||
class Console(object):
|
||||
"""This is the class defining the interface a console plugin must return
|
||||
for the _console/session element"""
|
||||
def __init__(self, node, config):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def connect(self, callback):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def write(self, data):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def wait_for_data(self, timeout=600):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
class _ConsoleHandler(object):
|
||||
def __init__(self, node, configmanager):
|
||||
self._console = plugin.handle_path("/node/%s/_console/session" % node,
|
@ -6,7 +6,7 @@
|
||||
import base64
|
||||
import Cookie
|
||||
import confluent.auth as auth
|
||||
import confluent.console as console
|
||||
import confluent.consoleserver as consoleserver
|
||||
import confluent.pluginapi as pluginapi
|
||||
import confluent.util as util
|
||||
import eventlet
|
||||
@ -159,7 +159,7 @@ def resourcehandler(env, start_response):
|
||||
_, _, nodename = prefix.rpartition('/')
|
||||
if 'session' not in querydict.keys() or not querydict['session']:
|
||||
# Request for new session
|
||||
consession = console.ConsoleSession(node=nodename,
|
||||
consession = consoleserver.ConsoleSession(node=nodename,
|
||||
configmanager=cfgmgr)
|
||||
if not consession:
|
||||
start_response("500 Internal Server Error", headers)
|
||||
|
15
confluent/interface/console.py
Normal file
15
confluent/interface/console.py
Normal file
@ -0,0 +1,15 @@
|
||||
class Console(object):
|
||||
"""This is the class defining the interface a console plugin must return
|
||||
for the _console/session element"""
|
||||
def __init__(self, node, config):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def connect(self, callback):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def write(self, data):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
||||
def wait_for_data(self, timeout=600):
|
||||
raise NotImplementedException("Subclassing required")
|
||||
|
@ -17,7 +17,7 @@
|
||||
# functions. Console is special and just get's passed through
|
||||
# see API.txt
|
||||
|
||||
import confluent.console as console
|
||||
import confluent.interface.console as console
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -99,7 +99,7 @@ def handle_path(path, operation, configmanager):
|
||||
nodes=(node,), element=element,
|
||||
configmanager=configmanager)
|
||||
if plugroute['default']:
|
||||
passvalue pluginmap[plugroute['default']].__dict__[operation](
|
||||
passvalue = pluginmap[plugroute['default']].__dict__[operation](
|
||||
nodes=(node,), element=element, configmanager=configmanager)
|
||||
if isinstance(passvalue, console.Console):
|
||||
return passvalue
|
||||
|
@ -5,7 +5,7 @@
|
||||
# It implement unix and tls sockets
|
||||
#
|
||||
# TODO: SO_PEERCRED for unix socket
|
||||
import confluent.console as console
|
||||
import confluent.consoleserver as consoleserver
|
||||
import confluent.config as config
|
||||
import eventlet.green.socket as socket
|
||||
import eventlet.green.ssl as ssl
|
||||
@ -44,7 +44,7 @@ def sessionhdl(connection, authname):
|
||||
print passphrase
|
||||
connection.sendall("Confluent -- v0 -- Session Granted\r\n/->")
|
||||
cfm = config.ConfigManager(tenant=0)
|
||||
consession = console.ConsoleSession(node='n1', configmanager=cfm,
|
||||
consession = consoleserver.ConsoleSession(node='n1', configmanager=cfm,
|
||||
datacallback=connection.sendall)
|
||||
while (1):
|
||||
data = connection.recv(4096)
|
||||
|
Loading…
x
Reference in New Issue
Block a user