Skip to content
Snippets Groups Projects
Commit 05191311 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Display hosts with no interface

JIRA INFRA-569 #action In Progress
parent 9977c3e7
No related branches found
No related tags found
No related merge requests found
...@@ -473,18 +473,24 @@ def create_scope(): ...@@ -473,18 +473,24 @@ def create_scope():
@bp.route("/_retrieve_hosts") @bp.route("/_retrieve_hosts")
@login_required @login_required
def retrieve_hosts(): def retrieve_hosts():
data = [ data = []
( for host in models.Host.query.all():
host.name, if host.interfaces:
str(host.device_type), for interface in host.interfaces:
host.description, data.append(
interface.name, (
interface.ip, host.name,
str(interface.network), str(host.device_type),
) host.description,
for host in models.Host.query.all() interface.name,
for interface in host.interfaces interface.ip,
] str(interface.network),
)
)
else:
data.append(
(host.name, str(host.device_type), host.description, "", "", "")
)
return jsonify(data=data) return jsonify(data=data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment