summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-09-22 20:03:32 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-09-22 20:03:32 +0000
commitc042a7be419a3cbc0db0b59d3f4179404ec3dcf0 (patch)
tree353f854b31792e174f09b434725969aeb443ac81 /src
parentec7999775cc74f3eee97b84eb4e4ef9341da594b (diff)
downloadbcfg2-c042a7be419a3cbc0db0b59d3f4179404ec3dcf0.tar.gz
bcfg2-c042a7be419a3cbc0db0b59d3f4179404ec3dcf0.tar.bz2
bcfg2-c042a7be419a3cbc0db0b59d3f4179404ec3dcf0.zip
bug fixes in dhcp generation
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2298 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py2
-rw-r--r--src/lib/Server/Plugins/Hostbase.py10
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]]