perf: change secret automation

This commit is contained in:
feng
2022-10-19 17:05:21 +08:00
parent eb16e3c7cb
commit 26278cc9e0
16 changed files with 244 additions and 98 deletions

View File

@@ -3,18 +3,19 @@
#
from .change_secret.manager import ChangeSecretManager
from .gather_facts.manager import GatherFactsManager
from ..const import AutomationTypes
class ExecutionManager:
manager_type_mapper = {
'change_secret': ChangeSecretManager,
'gather_facts': GatherFactsManager,
AutomationTypes.change_secret: ChangeSecretManager,
AutomationTypes.gather_facts: GatherFactsManager,
}
def __init__(self, execution):
self.execution = execution
self._runner = self.manager_type_mapper[execution.automation.type](execution)
self._runner = self.manager_type_mapper[execution.manager_type](execution)
def run(self, **kwargs):
return self._runner.run(**kwargs)
def run(self, *args, **kwargs):
return self._runner.run(*args, **kwargs)