def _get_agent_by_type_and_host(self, context, agent_type, host):
query = context.session.query(H3CAgent)
try:
agent_db = query.filter_by(agent_type=agent_type,
host=host).one()
return agent_db
except exc.NoResultFound:
raise ext_a.AgentNotFoundByTypeHost(agent_type=agent_type,
host=host)
except exc.MultipleResultsFound:
raise ext_a.MultipleAgentFoundByTypeHost(agent_type=agent_type,
host=host)
评论列表
文章目录