summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-09-08 20:11:58 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-09-08 20:11:58 +0000
commit064b4ca0e8d28062dbd028ca61f79798b84e260b (patch)
tree6457009c86c631e38163bfda55e0a78a757c3088
parent77bb154d6526739dc111d576f3ccb2392e2a1832 (diff)
downloadbcfg2-064b4ca0e8d28062dbd028ca61f79798b84e260b.tar.gz
bcfg2-064b4ca0e8d28062dbd028ca61f79798b84e260b.tar.bz2
bcfg2-064b4ca0e8d28062dbd028ca61f79798b84e260b.zip
minor updates
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2230 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Hostbase/hostbase/models.py1
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py5
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/host.html50
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/results.html22
-rw-r--r--src/lib/Server/Hostbase/templates/dhcpd.tmpl192
-rw-r--r--src/lib/Server/Plugins/Hostbase.py6
6 files changed, 200 insertions, 76 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/models.py b/src/lib/Server/Hostbase/hostbase/models.py
index 92bbb4b00..7c47b65bd 100644
--- a/src/lib/Server/Hostbase/hostbase/models.py
+++ b/src/lib/Server/Hostbase/hostbase/models.py
@@ -54,6 +54,7 @@ class Host(models.Model):
expiration_date = models.DateField(null=True, blank=True)
last = models.DateField(auto_now=True, auto_now_add=True)
status = models.CharField(maxlength=7, choices=STATUS_CHOICES)
+ dirty = models.BooleanField()
class Admin:
list_display = ('hostname', 'last')
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py
index 299cc5829..c3b850442 100644
--- a/src/lib/Server/Hostbase/hostbase/views.py
+++ b/src/lib/Server/Hostbase/hostbase/views.py
@@ -10,6 +10,7 @@ from hostbase.models import *
from Cheetah.Template import Template
from datetime import date
from django.db import connection
+from django.shortcuts import render_to_response
import re
templatedir = '/usr/lib/python2.3/site-packages/Hostbase/hostbase/webtemplates'
@@ -90,9 +91,7 @@ def search(request):
cursor.execute(querystring)
results = cursor.fetchall()
- temp = Template(open('%s/results.html' % templatedir).read())
- temp.hosts = results
- return HttpResponse(str(temp))
+ return render_to_response('%s/results.html' % templatedir, {'hosts': results})
else:
temp = Template(open('%s/search.html' % templatedir).read())
temp.TYPE_CHOICES = Interface.TYPE_CHOICES
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
index 43baa14c6..937d0115d 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
@@ -100,49 +100,49 @@
<tr> <td> <b>printq</b></td>
<td> $host.printq</td></tr>
<tr> <td> <b>dhcp</b></td>
- #if $host.dhcp
+ {% if host.dhcp %}
<td> y </td></tr>
- #else
+ {% else %}
<td> n </td></tr>
- #end if
+ {% endif %}
<tr> <td> <b>outbound_smtp</b></td>
- #if $host.outbound_smtp
+ {% if host.outbound_smtp %}
<td> y </td></tr>
- #else
+ {% else %}
<td> n </td></tr>
- #end if
+ {% endif %}
<tr> <td> <b>primary_user</b></td>
- <td> $host.primary_user</td></tr>
+ <td> {{ host.primary_user }}</td></tr>
<tr> <td> <b>administrator</b></td>
- <td> $host.administrator</td></tr>
+ <td> {{ host.administrator }}</td></tr>
<tr> <td> <b>location</b></td>
- <td> $host.location</td></tr>
+ <td> {{ host.location }}</td></tr>
<tr> <td> <b>expiration_date</b></td>
- <td> $host.expiration_date</td></tr>
- #for $interface in $interfaces
+ <td> {{ host.expiration_date }}</td></tr>
+ {% for interface in interfaces %}
<tr> <td><br><b>Interface</b></td>
- #if $interface.hdwr_type != 'no'
- <td><br>$interface.hdwr_type </td></tr>
- #end if
+ {% ifnotequal interface.hdwr_type 'no' %}
+ <td><br>{{ interface.hdwr_type }}</td></tr>
+ {% endif %}
<tr> <td> <b>mac_addr</b></td>
- <td> $interface.mac_addr </b></td></tr>
- #for $ip in $ips[$interface.id]
+ <td> {{ interface.mac_addr }}</b></td></tr>
+ {% for ip in ips.{{ interface.id }} %}
<tr> <td> <b>ip_addr</b></td>
- <td> $ip.ip_addr</td></tr>
- #end for
- #end for
+ <td> {{ ip.ip_addr }}</td></tr>
+ {% endfor %}
+ {% endfor %}
<tr> <td valign="top"> <b>comments</b></td>
<td>
- #for $line in $host.comments.split("\n")
- $line<br>
- #end for
+ {% for line in host.comments.split("\n") %}
+ {{ line }}<br>
+ {% endfor %}
</td></tr>
</table>
-<a style="font-size:75%" href="/hostbase/$host.id/dns/">see detailed DNS information for this host</a>
+<a style="font-size:75%" href="/hostbase/{{ host.id }}/dns/">see detailed DNS information for this host</a>
<br><br>
-this host is $host.status<br>
-last update on $host.last<br>
+this host is {{ host.status }}<br>
+last update on {{ host.last }}<br>
<!-- InstanceEndEditable --></td>
</tr>
</table></td>
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/results.html b/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
index 470883e61..1825f6d95 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
@@ -81,7 +81,7 @@
<td nowrap><table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td><!-- InstanceBeginEditable name="mainFeature" -->
-#if $hosts
+{% if hosts %}
<table border="0" width="100%">
<colgroup>
<col width="200">
@@ -91,22 +91,22 @@
<tr> <td><b>hostname</b></td>
<td> <b>status</b> </td>
</tr>
- #for $host in $hosts
- <tr> <td> $host[0]</td>
- #if $host[2]
+ {% for host in hosts %}
+ <tr> <td>{{ host.0 }}</td>
+ {% if host.2 %}
<td> active </td>
- #else
+ {% else %}
<td> inactive </td>
- #end if
- <td> <a href="$host[1]">view</a> </td>
- <td> <a href="$host[1]/edit">edit</a> </td>
+ {% endif %}
+ <td> <a href="{{ host.1 }}">view</a> </td>
+ <td> <a href="{{ host.1 }}/edit">edit</a> </td>
</tr>
- #end for
+ {% endfor %}
</table>
-#else
+{% else %}
No hosts matched your query<br>
Click the back button on your browser to edit your search
-#end if
+{% endif %}
<!-- InstanceEndEditable --></td>
</tr>
</table></td>
diff --git a/src/lib/Server/Hostbase/templates/dhcpd.tmpl b/src/lib/Server/Hostbase/templates/dhcpd.tmpl
index a7bfdb7e2..3784ae792 100644
--- a/src/lib/Server/Hostbase/templates/dhcpd.tmpl
+++ b/src/lib/Server/Hostbase/templates/dhcpd.tmpl
@@ -1,9 +1,6 @@
#
# This file is automatically generated.
# DO NOT EDIT IT BY HAND!
-# To update the contents of this file execute a 'make dhcp'
-# and then an 'install dhcp' in /mcs/adm/hostbase as root on
-# antares. This datafile is for use with the ISC dhcpd server.
#
# This file contains $numips IP addresses
# Generated on: $timecreated
@@ -19,7 +16,7 @@ server-identifier thwap.mcs.anl.gov;
# option definitions common to all supported networks...
option domain-name "mcs.anl.gov";
-option domain-name-servers adc.mcs.anl.gov, antares-9.mcs.anl.gov, dns2.anl.gov;
+option domain-name-servers adc.mcs.anl.gov, antares-9.mcs.anl.gov, t1dns2.anl.gov, t1dns1.anl.gov;
option option-140 code 140 = text;
default-lease-time 28800;
max-lease-time 28800;
@@ -46,8 +43,8 @@ shared-network "SystemsNet" {
server-identifier 140.221.9.112;
option subnet-mask 255.255.255.0;
option broadcast-address 140.221.2.255;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.2.1;
option option-140 "140.221.9.24";
default-lease-time 28800;
@@ -86,12 +83,133 @@ shared-network "SystemsNet" {
} # End systems vlan
+shared-network "Wireless" {
+
+ subnet 140.221.56.0 netmask 255.255.254.0 {
+ option subnet-mask 255.255.254.0;
+ option routers 140.221.57.253;
+ server-identifier 140.221.9.112;
+ option broadcast-address 140.221.57.255;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
+ option option-140 "140.221.9.24";
+ default-lease-time 28800;
+ max-lease-time 28800;
+ deny unknown-clients;
+ }
+
+ subnet 140.221.119.0 netmask 255.255.255.0 {
+ option subnet-mask 255.255.255.0;
+ option routers 140.221.119.1;
+ option broadcast-address 140.221.119.255;
+ default-lease-time 28800;
+ max-lease-time 28800;
+ deny unknown-clients;
+ }
+
+ subnet 140.221.120.0 netmask 255.255.255.0 {
+ pool {
+ range 140.221.120.10 140.221.120.199;
+ server-identifier 140.221.9.112;
+ option subnet-mask 255.255.255.0;
+ option broadcast-address 140.221.120.255;
+ option routers 140.221.120.1;
+ deny unknown-clients;
+ default-lease-time 3600;
+ max-lease-time 3600;
+ }
+ }
+
+ subnet 10.0.16.0 netmask 255.255.255.0 {
+ pool {
+ range 10.0.16.10 10.0.16.199;
+ allow unknown-clients;
+ option subnet-mask 255.255.255.0;
+ option broadcast-address 10.0.16.255;
+ option netbios-name-servers 10.0.16.1;
+ option routers 10.0.16.1;
+ option domain-name "guest.mcs.anl.gov";
+ option domain-name-servers 10.0.16.1;
+ server-identifier 10.0.16.1;
+ default-lease-time 60;
+ max-lease-time 60;
+ }
+ }
+
+} # End Wireless vlan
+
+shared-network "I2U2" {
+
+ subnet 192.5.186.64 netmask 255.255.255.192 {
+ option subnet-mask 255.255.255.192;
+ option routers 192.5.186.65;
+ option domain-name "i2u2.org";
+ option domain-name-servers 140.221.9.6, 130.202.101.37, 130.202.101.6;
+ server-identifier 140.221.9.112;
+ option broadcast-address 192.5.186.127;
+ default-lease-time 28800;
+ max-lease-time 28800;
+ deny unknown-clients;
+ }
+
+ subnet 10.5.186.64 netmask 255.255.255.192 {
+ pool {
+ range 10.5.186.70 10.5.186.90;
+ allow unknown-clients;
+ option subnet-mask 255.255.255.192;
+ option broadcast-address 10.5.186.127;
+ option netbios-name-servers 10.5.186.66;
+ option routers 10.5.186.65;
+ option domain-name "guest.i2u2.org";
+ option domain-name-servers 10.5.186.66;
+ server-identifier 10.5.186.66;
+ default-lease-time 60;
+ max-lease-time 60;
+ }
+ }
+
+} # End I2U2 vlan
+
+# Subnet 338 for CPH folk
+subnet 140.221.12.0 netmask 255.255.255.0 {
+ server-identifier 140.221.9.112;
+ range 140.221.12.200 140.221.12.210;
+ option subnet-mask 255.255.255.0;
+ option broadcast-address 140.221.12.255;
+ option routers 140.221.12.1;
+ option netbios-name-servers 146.137.96.90, 146.137.162.86;
+ default-lease-time 28800;
+ max-lease-time 28800;
+}
+# Subnet 338 for CPH printers
+subnet 140.221.14.0 netmask 255.255.255.192 {
+ server-identifier 140.221.9.112;
+ option subnet-mask 255.255.255.192;
+ option broadcast-address 140.221.14.63;
+ option routers 140.221.14.1;
+ option netbios-name-servers 146.137.96.90, 146.137.162.86;
+ default-lease-time 28800;
+ max-lease-time 28800;
+}
+
+# vlan85 - nmpdr
+subnet 192.5.200.0 netmask 255.255.255.128 {
+ server-identifier 140.221.9.112;
+ option subnet-mask 255.255.255.128;
+ option broadcast-address 192.5.200.127;
+ option domain-name-servers 140.221.9.6, 130.202.101.37, 130.202.101.6;
+ option routers 192.5.200.1;
+ default-lease-time 28800;
+ max-lease-time 28800;
+}
+
+
shared-network "BorgNet" {
subnet 140.221.8.0 netmask 255.255.252.0 {
option subnet-mask 255.255.252.0;
option broadcast-address 140.221.11.255;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.11.253;
option option-140 "140.221.9.24";
deny unknown-clients;
@@ -101,8 +219,8 @@ subnet 140.221.5.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 140.221.5.255;
option routers 140.221.5.1;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.5.1;
deny unknown-clients;
}
@@ -115,19 +233,19 @@ subnet 140.221.5.0 netmask 255.255.255.0 {
}
} # End of borg vlan
-shared-network "WirelessNet" {
- subnet 140.221.56.0 netmask 255.255.254.0 {
- option subnet-mask 255.255.254.0;
- # option broadcast-address 140.221.57.255;
- option routers 140.221.57.253;
-}
- subnet 140.221.120.0 netmask 255.255.255.0 {
- range 140.221.120.10 140.221.120.199;
- option subnet-mask 255.255.255.0;
- option broadcast-address 140.221.120.255;
- option routers 140.221.120.1;
-}
-} # end "WirelessNet"
+#shared-network "WirelessNet" {
+# subnet 140.221.56.0 netmask 255.255.254.0 {
+# option subnet-mask 255.255.254.0;
+# # option broadcast-address 140.221.57.255;
+# option routers 140.221.57.253;
+#}
+# subnet 140.221.120.0 netmask 255.255.255.0 {
+# range 140.221.120.10 140.221.120.199;
+# option subnet-mask 255.255.255.0;
+# option broadcast-address 140.221.120.255;
+# option routers 140.221.120.1;
+#}
+#} # end "WirelessNet"
subnet 140.221.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
@@ -161,14 +279,17 @@ subnet 140.221.7.0 netmask 255.255.255.0 {
subnet 140.221.13.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
- option routers 140.221.13.253;
+ option broadcast-address 140.221.13.255;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
+ option routers 140.221.13.1;
}
subnet 140.221.15.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 140.221.15.255;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.10.253;
}
@@ -218,21 +339,20 @@ subnet 140.221.34.0 netmask 255.255.255.240 {
range 140.221.34.6 140.221.34.6;
range 140.221.34.12 140.221.34.12;
option subnet-mask 255.255.255.240;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.34.13;
}
subnet 140.221.34.64 netmask 255.255.255.192 {
range 140.221.34.77 140.221.34.77;
- range 140.221.34.91 140.221.34.91;
- range 140.221.34.92 140.221.34.92;
- range 140.221.34.93 140.221.34.93;
- range 140.221.34.94 140.221.34.94;
- range 140.221.34.95 140.221.34.95;
+ range 140.221.34.80 140.221.34.80;
+ range 140.221.34.82 140.221.34.82;
+ range 140.221.34.91 140.221.34.95;
+ range 140.221.34.121 140.221.34.125;
option subnet-mask 255.255.255.192;
- option netbios-name-servers 10.140.221.10, 140.221.9.66;
- option netbios-node-type 2;
+ option netbios-name-servers 140.221.9.66;
+ option netbios-node-type 8;
option routers 140.221.34.65;
option option-140 "140.221.9.24";
}
@@ -252,7 +372,7 @@ subnet 140.221.36.0 netmask 255.255.255.192 {
subnet 140.221.37.0 netmask 255.255.255.128 {
option subnet-mask 255.255.255.128;
- option domain-name-servers ntnode01-37.mcs.anl.gov, antares-9.mcs.anl.gov, dns2.anl.gov;
+ option domain-name-servers antares-9.mcs.anl.gov, t1dns2.anl.gov;
option netbios-name-servers 140.221.37.41;
option routers 140.221.37.1;
}
diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py
index 27fe98ef7..204fcc4c8 100644
--- a/src/lib/Server/Plugins/Hostbase.py
+++ b/src/lib/Server/Plugins/Hostbase.py
@@ -94,7 +94,7 @@ class Hostbase(Plugin):
SubElement(output, "ConfigFile", name="/etc/dhcpd.conf")
return [output]
- def rebuildState(self):
+ def rebuildState(self, _):
'''Pre-cache all state information for hostbase config files'''
from django.db import connection
@@ -517,3 +517,7 @@ olivia.ctd.anl.gov\n\n"""
fileoutput += each + "\n"
self.filedata['%s-machines' % netgroup] = fileoutput
self.Entries['ConfigFile']['%s-machines' % netgroup] = self.FetchFile
+
+ cursor.execute("""
+ UPDATE hostbase_host SET dirty=0
+ """)