diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/views.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Hostbase.py | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index 8d7fd3d3a..ad681bf76 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -6,7 +6,7 @@ Also has does form validation __revision__ = 0.1 from django.http import HttpResponse, HttpResponseRedirect -from hostbase.models import * +from Hostbase.hostbase.models import * from datetime import date from django.db import connection from django.shortcuts import render_to_response diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py index 36d2a348d..938e2dceb 100644 --- a/src/lib/Server/Plugins/Hostbase.py +++ b/src/lib/Server/Plugins/Hostbase.py @@ -278,21 +278,19 @@ class Hostbase(Plugin): count = 0 hosts = [] hostdata = [dhcphosts[0][0], dhcphosts[0][1], dhcphosts[0][2]] - for x in range(1, len(cursor.fetchall())-1): + for x in range(1, len(cursor.fetchall())): # if an interface has 2 or more ip addresses # adds the ip to the current interface - if hostdata[0] == dhcphosts[x][0] and hostdata[1] == dhcphosts[x][1]: + if hostdata[0].split(".")[0] == dhcphosts[x][0].split(".")[0] and hostdata[1] == dhcphosts[x][1]: hostdata[2] = ", ".join([hostdata[2], dhcphosts[x][2]]) # if a host has 2 or more interfaces # writes the current one and grabs the next - elif hostdata[0] == dhcphosts[x][0]: + elif hostdata[0].split(".")[0] == dhcphosts[x][0].split(".")[0]: hosts.append(hostdata) count += 1 - hostdata = [dhcphosts[x][0], dhcphosts[x][1], dhcphosts[x][2]] + hostdata = ["-".join([dhcphosts[x][0], str(count)]), dhcphosts[x][1], dhcphosts[x][2]] # new host found, writes current data to the template else: - if count: - hostdata[0] = "-".join([hostdata[0], str(count)]) hosts.append(hostdata) count = 0 hostdata = [dhcphosts[x][0], dhcphosts[x][1], dhcphosts[x][2]] |