pluginserver 0.6.2__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pluginserver-0.6.2/pluginserver.egg-info → pluginserver-0.7.0}/PKG-INFO +1 -1
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/baseplugin.py +4 -1
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/pluginmanager.py +4 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/pserv.py +20 -1
- {pluginserver-0.6.2 → pluginserver-0.7.0/pluginserver.egg-info}/PKG-INFO +1 -1
- {pluginserver-0.6.2 → pluginserver-0.7.0}/setup.py +1 -1
- {pluginserver-0.6.2 → pluginserver-0.7.0}/LICENSE.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/MANIFEST.in +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/README.md +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/__init__.py +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/configfile.py +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/plugincore/cors.py +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/pluginserver.egg-info/SOURCES.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/pluginserver.egg-info/dependency_links.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/pluginserver.egg-info/entry_points.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/pluginserver.egg-info/requires.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/pluginserver.egg-info/top_level.txt +0 -0
- {pluginserver-0.6.2 → pluginserver-0.7.0}/setup.cfg +0 -0
|
@@ -30,6 +30,9 @@ class BasePlugin:
|
|
|
30
30
|
self._auth_type = 'plugin'
|
|
31
31
|
self.args = dict(kwargs)
|
|
32
32
|
|
|
33
|
+
def terminate_plugin(self):
|
|
34
|
+
pass
|
|
35
|
+
|
|
33
36
|
def _check_auth(self,data):
|
|
34
37
|
toktype = 'Undefined'
|
|
35
38
|
def get_token(data):
|
|
@@ -78,7 +81,7 @@ class BasePlugin:
|
|
|
78
81
|
if auth_check:
|
|
79
82
|
result = self.request_handler(**data)
|
|
80
83
|
code, response = await result if inspect.isawaitable(result) else result
|
|
81
|
-
print(f"Got {code} - {response}")
|
|
84
|
+
#print(f"Got {code} - {response}")
|
|
82
85
|
else:
|
|
83
86
|
code, response = 403, {'error': 'unauthorized'}
|
|
84
87
|
if not isinstance(response,web.Response):
|
|
@@ -66,6 +66,10 @@ class PluginManager:
|
|
|
66
66
|
return
|
|
67
67
|
|
|
68
68
|
# Try to remove the module
|
|
69
|
+
try:
|
|
70
|
+
plugin.terminate_plugin()
|
|
71
|
+
except Exception as e:
|
|
72
|
+
print(f"Exception {type(e)} Unloading plugin - terminate_plugin threw {e}")
|
|
69
73
|
module_name = plugin.__class__.__module__
|
|
70
74
|
module_file = os.path.basename(module_name + ".py")
|
|
71
75
|
print(f"Removing plugin {plugin_id} from module {module_name}")
|
|
@@ -18,6 +18,21 @@ import aiohttp_cors
|
|
|
18
18
|
from aiohttp import web
|
|
19
19
|
|
|
20
20
|
corsobj = CORS()
|
|
21
|
+
|
|
22
|
+
async def on_shutdown(*args):
|
|
23
|
+
"""
|
|
24
|
+
call terminate_plugin for active plugins
|
|
25
|
+
"""
|
|
26
|
+
global manager
|
|
27
|
+
print(("Sending plugins the terminate signal"))
|
|
28
|
+
for id, plugin in manager.plugins.items():
|
|
29
|
+
try:
|
|
30
|
+
plugin.terminate_plugin()
|
|
31
|
+
except Exception as e:
|
|
32
|
+
print(f"{type(e)} Exception unloading plugin id {id}")
|
|
33
|
+
print("Waiting for tasks")
|
|
34
|
+
await asyncio.sleep(3)
|
|
35
|
+
|
|
21
36
|
def main():
|
|
22
37
|
global manager
|
|
23
38
|
global globalCfg
|
|
@@ -86,7 +101,11 @@ def main():
|
|
|
86
101
|
corsobj.setup(app,globalCfg)
|
|
87
102
|
|
|
88
103
|
app.add_routes(routes)
|
|
89
|
-
|
|
104
|
+
app.on_shutdown.append(on_shutdown)
|
|
105
|
+
try:
|
|
106
|
+
web.run_app(app, host=globalCfg.network.bindto, port=globalCfg.network.port, ssl_context=ssl_ctx)
|
|
107
|
+
except KeyboardInterrupt:
|
|
108
|
+
on_shutdown()
|
|
90
109
|
|
|
91
110
|
# --- Auth Helper ---
|
|
92
111
|
def check_auth(data, config):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|