From 25851278da600c92a7c84401e338029d7e8d800c Mon Sep 17 00:00:00 2001 From: Graham Gilbert Date: Mon, 27 Jan 2014 17:30:06 +0000 Subject: [PATCH] Show the LAN IP address(es) on the machine detail page --- server/templates/server/machine_detail.html | 4 ++++ server/views.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/templates/server/machine_detail.html b/server/templates/server/machine_detail.html index f1aec13..2e1e26d 100644 --- a/server/templates/server/machine_detail.html +++ b/server/templates/server/machine_detail.html @@ -51,6 +51,10 @@

Machine

Serial: {{ machine.serial }} + + LAN IP Address: + {{ ip_address }} + {% if 'MachineInfo' in report %} Hostname: diff --git a/server/views.py b/server/views.py index 62d9a4f..5bbce60 100644 --- a/server/views.py +++ b/server/views.py @@ -423,6 +423,12 @@ def machine_detail(request, machine_id): conditions = conditions.exclude(condition_name=excluded) else: conditions = None + + # get the IP address(es) from the condition + ip_address = conditions.get(machine=machine, condition_name__exact='ipv4_address') + ip_address = ip_address.condition_data + print ip_address + install_results = {} for result in report.get('InstallResults', []): nameAndVers = result['name'] + '-' + result['version'] @@ -475,7 +481,7 @@ def machine_detail(request, machine_id): if 'managed_uninstalls_list' in report: report['managed_uninstalls_list'].sort() - c = {'user':user, 'machine_group': machine_group, 'business_unit': business_unit, 'report': report, 'install_results': install_results, 'removal_results': removal_results, 'machine': machine, 'facts':facts, 'conditions':conditions } + c = {'user':user, 'machine_group': machine_group, 'business_unit': business_unit, 'report': report, 'install_results': install_results, 'removal_results': removal_results, 'machine': machine, 'facts':facts, 'conditions':conditions, 'ip_address':ip_address } return render_to_response('server/machine_detail.html', c, context_instance=RequestContext(request)) # checkin