sharing: add option for verification of sharing config database
This commit is contained in:
@@ -33,7 +33,8 @@ import sys
|
|||||||
from types import FrameType
|
from types import FrameType
|
||||||
from typing import List, Optional, cast
|
from typing import List, Optional, cast
|
||||||
|
|
||||||
from radicale import VERSION, config, item, log, server, storage, types
|
from radicale import (VERSION, config, item, log, server, sharing, storage,
|
||||||
|
types)
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +68,8 @@ def run() -> None:
|
|||||||
help="check the storage for errors and exit")
|
help="check the storage for errors and exit")
|
||||||
parser.add_argument("--verify-item", action="store", nargs=1,
|
parser.add_argument("--verify-item", action="store", nargs=1,
|
||||||
help="check the provided item file for errors and exit")
|
help="check the provided item file for errors and exit")
|
||||||
|
parser.add_argument("--verify-sharing", action="store_true",
|
||||||
|
help="check the sharing database for errors and exit")
|
||||||
parser.add_argument("-C", "--config",
|
parser.add_argument("-C", "--config",
|
||||||
help="use specific configuration files", nargs="*")
|
help="use specific configuration files", nargs="*")
|
||||||
parser.add_argument("-D", "--debug", action="store_const", const="debug",
|
parser.add_argument("-D", "--debug", action="store_const", const="debug",
|
||||||
@@ -209,6 +212,19 @@ def run() -> None:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if args_ns.verify_sharing:
|
||||||
|
logger.info("Verifying sharing database")
|
||||||
|
try:
|
||||||
|
sharing_ = sharing.load(configuration)
|
||||||
|
if not sharing_.verify():
|
||||||
|
logger.critical("Sharing database verification failed")
|
||||||
|
sys.exit(1)
|
||||||
|
except Exception as e:
|
||||||
|
logger.critical("An exception occurred during sharing database "
|
||||||
|
"verification: %s", e, exc_info=True)
|
||||||
|
sys.exit(1)
|
||||||
|
return
|
||||||
|
|
||||||
# Create a socket pair to notify the server of program shutdown
|
# Create a socket pair to notify the server of program shutdown
|
||||||
shutdown_socket, shutdown_socket_out = socket.socketpair()
|
shutdown_socket, shutdown_socket_out = socket.socketpair()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user