jumpserver/apps/assets/automations/endpoint.py

22 lines
627 B
Python
Raw Normal View History

2022-10-09 12:54:11 +00:00
# from .backup.manager import AccountBackupExecutionManager
#
#
2022-10-13 09:47:29 +00:00
from .change_secret.manager import ChangeSecretManager
2022-10-17 03:22:21 +00:00
from .gather_facts.manager import GatherFactsManager
2022-10-19 09:05:21 +00:00
from ..const import AutomationTypes
2022-10-10 05:56:42 +00:00
2022-10-09 12:54:11 +00:00
class ExecutionManager:
2022-10-10 05:56:42 +00:00
manager_type_mapper = {
2022-10-19 09:05:21 +00:00
AutomationTypes.change_secret: ChangeSecretManager,
AutomationTypes.gather_facts: GatherFactsManager,
2022-10-09 12:54:11 +00:00
}
2022-10-10 05:56:42 +00:00
def __init__(self, execution):
self.execution = execution
2022-10-19 09:05:21 +00:00
self._runner = self.manager_type_mapper[execution.manager_type](execution)
2022-10-10 05:56:42 +00:00
2022-10-19 09:05:21 +00:00
def run(self, *args, **kwargs):
return self._runner.run(*args, **kwargs)
2022-10-10 05:56:42 +00:00