support systemd notify and watchdog
This commit is contained in:
@@ -12,6 +12,8 @@ import capport.utils.cli
|
||||
import capport.utils.nft_set
|
||||
import trio
|
||||
from capport import cptypes
|
||||
from capport.utils.sd_notify import open_sdnotify
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -42,13 +44,16 @@ class ControlApp(capport.comm.hub.HubApplication):
|
||||
|
||||
|
||||
async def amain(config: capport.config.Config) -> None:
|
||||
app = ControlApp()
|
||||
hub = capport.comm.hub.Hub(config=config, app=app, is_controller=True)
|
||||
app.hub = hub
|
||||
async with trio.open_nursery() as nursery:
|
||||
# hub.run loads the statefile from disk before signalling it was "started"
|
||||
await nursery.start(hub.run)
|
||||
app.apply_db_entries(hub.database.entries())
|
||||
async with open_sdnotify() as sn:
|
||||
app = ControlApp()
|
||||
hub = capport.comm.hub.Hub(config=config, app=app, is_controller=True)
|
||||
app.hub = hub
|
||||
async with trio.open_nursery() as nursery:
|
||||
# hub.run loads the statefile from disk before signalling it was "started"
|
||||
await nursery.start(hub.run)
|
||||
await sn.send('READY=1', 'STATUS=Deploying initial entries to nftables set')
|
||||
app.apply_db_entries(hub.database.entries())
|
||||
await sn.send('STATUS=Kernel fully synchronized')
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
Reference in New Issue
Block a user