INNER CODE UNIT · Python
get_logs
sky22333/ansible-ui · app.py:365
def get_logs():
"""获取命令执行日志"""
limit = request.args.get('limit', default=100, type=int)
logs = db.get_command_logs(limit)
return jsonify(logs)
@app.route('/api/hosts/<int:host_id>/facts', methods=['GET'])
@handle_error
@auth_required
def get_host_facts(host_id):
"""获取主机详细信息"""
facts = ansible.get_host_facts(host_id)
if facts:
return jsonify(facts)
return jsonify({'error': 'Failed to get host facts'}), 404
@app.route('/api/hosts/<int:host_id>/ping', methods=['GET'])
@handle_error