2022-10-28 10:28:41 +00:00
|
|
|
from common.utils import get_logger
|
|
|
|
from assets.const import AutomationTypes, Connectivity
|
|
|
|
from ..base.manager import BasePlaybookManager, PushOrVerifyHostCallbackMixin
|
|
|
|
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class VerifyAccountManager(PushOrVerifyHostCallbackMixin, BasePlaybookManager):
|
2022-11-04 11:18:15 +00:00
|
|
|
need_privilege_account = False
|
2022-10-28 10:28:41 +00:00
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.host_account_mapper = {}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def method_type(cls):
|
|
|
|
return AutomationTypes.verify_account
|
|
|
|
|
|
|
|
def on_host_success(self, host, result):
|
|
|
|
account = self.host_account_mapper.get(host)
|
2022-11-08 09:54:51 +00:00
|
|
|
account.set_connectivity(Connectivity.OK)
|
2022-10-28 10:28:41 +00:00
|
|
|
|
|
|
|
def on_host_error(self, host, error, result):
|
|
|
|
account = self.host_account_mapper.get(host)
|
2022-11-08 09:54:51 +00:00
|
|
|
account.set_connectivity(Connectivity.FAILED)
|