diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index 555130d9..dac3c29e 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -175,11 +175,11 @@ noderesources = { }, 'shell': { # another special case similar to console - 'sessions': [], + 'sessions': {}, }, 'console': { # this is a dummy value, http or socket must handle special - 'session': PluginRoute({}), + 'session': None, 'license': PluginRoute({ 'pluginattrs': ['hardwaremanagement.method'], 'default': 'ipmi', @@ -510,6 +510,8 @@ def handle_node_request(configmanager, inputdata, operation, iscollection = True elif isinstance(routespec, PluginCollection): iscollection = False # it is a collection, but plugin defined + elif routespec is None: + raise exc.InvalidArgumentException('Custom interface required for resource') if iscollection: if operation == "delete": return delete_node_collection(pathcomponents, configmanager) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index f294c7c8..c66f8f32 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -25,6 +25,7 @@ import confluent.exceptions as exc import confluent.log as log import confluent.messages import confluent.core as pluginapi +import confluent.shellserver as shellserver import confluent.tlvdata import confluent.util as util import copy @@ -326,9 +327,15 @@ def resourcehandler_backend(env, start_response): ("Set-Cookie", m.OutputString()) for m in authorized['cookie'].values()) cfgmgr = authorized['cfgmgr'] - if '/console/session' in env['PATH_INFO']: + if (operation == 'create' and ('/console/session' in env['PATH_INFO'] or + '/shell/sessions/' in env['PATH_INFO'])): #hard bake JSON into this path, do not support other incarnations - prefix, _, _ = env['PATH_INFO'].partition('/console/session') + if '/console/session' in env['PATH_INFO']: + prefix, _, _ = env['PATH_INFO'].partition('/console/session') + shellsession = False + elif '/shell/sessions/' in env['PATH_INFO']: + prefix, _, _ = env['PATH_INFO'].partition('/shell/sessions') + shellsession = True _, _, nodename = prefix.rpartition('/') if 'session' not in querydict.keys() or not querydict['session']: auditmsg = { @@ -344,9 +351,14 @@ def resourcehandler_backend(env, start_response): if 'skipreplay' in querydict and querydict['skipreplay']: skipreplay = True try: - consession = consoleserver.ConsoleSession( - node=nodename, configmanager=cfgmgr, - username=authorized['username'], skipreplay=skipreplay) + if shellsession: + consession = shellserver.ShellSession( + node=nodename, configmanager=cfgmgr, + username=authorized['username'], skipreplay=skipreplay) + else: + consession = consoleserver.ConsoleSession( + node=nodename, configmanager=cfgmgr, + username=authorized['username'], skipreplay=skipreplay) except exc.NotFoundException: start_response("404 Not found", headers) yield "404 - Request Path not recognized"