outposts: implement .run_wuth_logs() which returns logs, add task monitoring
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
"""Base Controller"""
|
||||
from typing import Dict
|
||||
from typing import Dict, List
|
||||
|
||||
from structlog import get_logger
|
||||
from structlog.testing import capture_logs
|
||||
|
||||
from passbook.lib.sentry import SentryIgnoredException
|
||||
from passbook.outposts.models import Outpost
|
||||
@ -29,6 +30,12 @@ class BaseController:
|
||||
"""Called by scheduled task to reconcile deployment/service/etc"""
|
||||
raise NotImplementedError
|
||||
|
||||
def run_with_logs(self) -> List[str]:
|
||||
"""Call .run() but capture all log output and return it."""
|
||||
with capture_logs() as logs:
|
||||
self.run()
|
||||
return logs
|
||||
|
||||
def get_static_deployment(self) -> str:
|
||||
"""Return a static deployment configuration"""
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user