INNER CODE UNIT · Python
get_host
sky22333/ansible-ui · app.py:244
def get_host(host_id):
"""获取单个主机信息"""
host = db.get_host(host_id)
if host:
if host['auth_method'] == 'password':
host['is_password_encrypted'] = crypto.is_encrypted(host['encrypted_password'])
else:
host['is_password_encrypted'] = False
host['password'] = '********'
if 'encrypted_password' in host:
del host['encrypted_password']
return jsonify(host)
return jsonify({'error': 'Host not found'}), 404
@app.route('/api/hosts', methods=['POST'])
@handle_error
@auth_required
def add_host():