-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from mhcomm/dvl/quentin/new_remote_admin
new remote admin Plugin
- Loading branch information
Showing
12 changed files
with
620 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from aiohttp import web | ||
|
||
from pypeman.plugins.base import BasePlugin | ||
from pypeman.plugins.remoteadmin import urls | ||
|
||
|
||
class RemoteAdminPlugin(BasePlugin): | ||
|
||
def __init__(self, host="127.0.0.1", port=8091, url_prefix=""): | ||
super().__init__() | ||
self.app = web.Application() | ||
self.host = host | ||
self.port = port | ||
self.url_prefix = url_prefix | ||
self.runner = web.AppRunner(self.app) | ||
|
||
def ready(self): | ||
urls.init_urls(self.app, prefix=self.url_prefix) | ||
|
||
async def start(self): | ||
await self.runner.setup() | ||
site = web.TCPSite(self.runner, self.host, self.port) | ||
await site.start() | ||
|
||
async def stop(self): | ||
await self.runner.cleanup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from aiohttp import web | ||
|
||
from pypeman.plugins.remoteadmin import views | ||
|
||
|
||
def init_urls(app, prefix=""): | ||
""" | ||
Create the pypeman remoteadmin routing | ||
Args: | ||
app (aiohttp.web.Application): The aiohttp web app where the | ||
url routings have to be added | ||
""" | ||
app.add_routes([ | ||
# API : | ||
web.get(prefix + '/channels', views.list_channels), | ||
web.get(prefix + '/channels/{channelname}/start', views.start_channel), | ||
web.get(prefix + '/channels/{channelname}/stop', views.stop_channel), | ||
web.get(prefix + '/channels/{channelname}/messages', views.list_msgs), | ||
web.get(prefix + '/channels/{channelname}/messages/{message_id}/replay', views.replay_msg), | ||
web.get(prefix + '/channels/{channelname}/messages/{message_id}/view', views.view_msg), | ||
web.get(prefix + '/channels/{channelname}/messages/{message_id}/preview', views.preview_msg), | ||
# WEBSOCKETS : | ||
web.get(prefix + '/', views.backport_old_client), | ||
]) |
Oops, something went wrong.