def client(): if settings.MODE == 'agent': cli = AutoAgent() elif settings.MODE == 'ssh': cli = AutoSSH() elif settings.MODE == 'salt': cli = AutoSalt() else: raise Exception('请配置资产采集模式,如:ssh、agent、salt') ret = cli.process() return ret
def client(): # Agent模式 if settings.MODE == 'agent': cli = AutoAgent() # Snmp模式 elif settings.MODE == 'snmp': cli = AutoSnmp() # 非Agent或Snmp模式,则报异常 else: raise Exception('请配置资产采集模式,如:agent、snmp') cli.process()
def update_client(): if settings.MODE == 'agent': cli = AutoAgent(url=settings.UP_API_URL) elif settings.MODE == 'ssh': cli = AutoSSH() elif settings.MODE == 'salt': cli = AutoSalt() else: raise Exception('请配置资产采集模式,如:ssh、agent、salt') ret = cli.process() print(ret)
def client(): if settings.MODE == 'AGENT': cli = AutoAgent() elif settings.MODE == 'SSH': cli = AutoSSH() elif settings.MODE == 'SALT': cli = AutoSalt() else: raise Exception('请配置资产采集模式,如:ssh、agent、salt') cli.process()
def client(): if settings.MODE == 'agent': cli = AutoAgent(url=settings.API_URL) elif settings.MODE == 'ssh': cli = AutoSSH() elif settings.MODE == 'salt': cli = AutoSalt() else: raise Exception('请配置资产采集模式,如:ssh、agent、salt') cli.process()
def client(): try: cli = AutoAgent() cli.process() except Exception as e: print(e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # __author__= 'luhj' from src.client import AutoAgent from src.client import AutoSalt from src.client import AutoSSH from config import settings def client() if settings.MODE == 'agent': cli = AutoAgent() elif settings.MODE == 'ssh': cli = AutoSSH() elif settings.MODE == 'salt': cli = AutoSalt() else: raise Exception('资产采集模式配置错误[ssh,agent,salt]') cli.process()