diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-09-22 20:03:32 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-09-22 20:03:32 +0000 |
commit | c042a7be419a3cbc0db0b59d3f4179404ec3dcf0 (patch) | |
tree | 353f854b31792e174f09b434725969aeb443ac81 /src/lib/Server/Plugins/Hostbase.py | |
parent | ec7999775cc74f3eee97b84eb4e4ef9341da594b (diff) | |
download | bcfg2-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/lib/Server/Plugins/Hostbase.py')
-rw-r--r-- | src/lib/Server/Plugins/Hostbase.py | 10 |
1 files changed, 4 insertions, 6 deletions
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]] |