mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
plugins/clnrest: fail gracefully if dependencies not installed.
json and sys are Python built-in packages, so we can do this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# For --hidden-import gunicorn.glogging gunicorn.workers.sync
|
# For --hidden-import gunicorn.glogging gunicorn.workers.sync
|
||||||
|
try:
|
||||||
from gunicorn import glogging # noqa: F401
|
from gunicorn import glogging # noqa: F401
|
||||||
from gunicorn.workers import sync # noqa: F401
|
from gunicorn.workers import sync # noqa: F401
|
||||||
|
|
||||||
@@ -12,6 +13,15 @@ from utilities.generate_certs import generate_certs
|
|||||||
from utilities.shared import set_config
|
from utilities.shared import set_config
|
||||||
from utilities.rpc_routes import rpcns
|
from utilities.rpc_routes import rpcns
|
||||||
from utilities.rpc_plugin import plugin
|
from utilities.rpc_plugin import plugin
|
||||||
|
except ModuleNotFoundError as err:
|
||||||
|
# OK, something is not installed?
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
getmanfest = json.loads(sys.stdin.readline())
|
||||||
|
print(json.dumps({'jsonrpc': "2.0",
|
||||||
|
'id': getmanfest['id'],
|
||||||
|
'result': {'disable': str(err)}}))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
jobs = {}
|
jobs = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user