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-27 10:53:10 +00:00
|
|
|
from .gather_accounts.manager import GatherAccountsManager
|
2022-10-28 10:28:41 +00:00
|
|
|
from .verify_account.manager import VerifyAccountManager
|
|
|
|
from .push_account.manager import PushAccountManager
|
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-27 10:53:10 +00:00
|
|
|
AutomationTypes.gather_accounts: GatherAccountsManager,
|
2022-10-28 10:28:41 +00:00
|
|
|
AutomationTypes.verify_account: VerifyAccountManager,
|
|
|
|
AutomationTypes.push_account: PushAccountManager,
|
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
|
|
|
|