summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-11-10 18:41:52 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-11-10 18:41:52 +0000
commit2f6bdd309ffbb524f9a744aec1fe70e4c32a3acb (patch)
tree18a6b43e00c797e5b0a05bbb73a7ff6830ef3f7b
parente218f4db6a13e61af48d4de2fbc6cb88c1acb005 (diff)
downloadbcfg2-2f6bdd309ffbb524f9a744aec1fe70e4c32a3acb.tar.gz
bcfg2-2f6bdd309ffbb524f9a744aec1fe70e4c32a3acb.tar.bz2
bcfg2-2f6bdd309ffbb524f9a744aec1fe70e4c32a3acb.zip
addded initial data for reverse zones to make things less complex
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2481 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Hostbase/hostbase/sql/zone.sql2
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py2
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html2
-rw-r--r--src/lib/Server/Plugins/Hostbase.py17
4 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/sql/zone.sql b/src/lib/Server/Hostbase/hostbase/sql/zone.sql
new file mode 100644
index 000000000..b78187ab2
--- /dev/null
+++ b/src/lib/Server/Hostbase/hostbase/sql/zone.sql
@@ -0,0 +1,2 @@
+INSERT INTO hostbase_zone (zone, serial, admin, primary_master, expire, retry, refresh, ttl, aux)
+VALUES ('.rev', 0, '', '', 1209600, 1800, 7200, 7200, ''); \ No newline at end of file
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py
index c60e2c2ff..dd777eea6 100644
--- a/src/lib/Server/Hostbase/hostbase/views.py
+++ b/src/lib/Server/Hostbase/hostbase/views.py
@@ -818,7 +818,7 @@ def zoneedit(request, zone_id):
if created:
address.save()
zone.addresses.add(address)
- return HttpResponseRedirect('/hostbase/zones/%s/' % zone.id)
+ return HttpResponseRedirect('/hostbase/zones/%s/edit' % zone.id)
else:
zone = Zone.objects.get(id=zone_id)
return render_to_response('zoneedit.html',
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
index d1cf08f17..7eb7f2184 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
@@ -112,7 +112,7 @@ div#address{
<col width="*">
<tr><td valign="top"> <b>A records</b>
{% if addresses %}
- <br><a style="font-size:75%" href=# onclick="toggleField('address')">add a new MX record</a>
+ <br><a style="font-size:75%" href=# onclick="toggleField('address')">add a new A record</a>
{% endif %}
</td>
<td>
diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py
index 80afa0c06..b5a09e760 100644
--- a/src/lib/Server/Plugins/Hostbase.py
+++ b/src/lib/Server/Plugins/Hostbase.py
@@ -125,19 +125,18 @@ class Hostbase(Plugin):
serial = int(todaydate) * 100
cursor.execute("""UPDATE hostbase_zone SET serial = \'%s\' WHERE id = \'%s\'""" % (str(serial), zone[0]))
- cursor.execute("SELECT * FROM hostbase_zone")
+ cursor.execute("SELECT * FROM hostbase_zone WHERE zone <> \'.rev\'")
zones = cursor.fetchall()
iplist = []
hosts = {}
- for zone in zones:
- if zone[1] == 'mcs.anl.gov':
- reversezone = zone
- cursor.execute("""SELECT n.name FROM hostbase_zone_nameservers z
- INNER JOIN hostbase_nameserver n ON z.nameserver_id = n.id
- WHERE z.zone_id = \'%s\'""" % zone[0])
- mcs_nameservers = cursor.fetchall()
+ cursor.execute("SELECT * FROM hostbase_zone WHERE zone = \'.rev\'")
+ reversezone = cursor.fetchall()[0]
+ cursor.execute("""SELECT n.name FROM hostbase_zone_nameservers z
+ INNER JOIN hostbase_nameserver n ON z.nameserver_id = n.id
+ WHERE z.zone_id = \'%s\'""" % reversezone[0])
+ reverse_nameservers = cursor.fetchall()
for zone in zones:
@@ -223,7 +222,7 @@ class Hostbase(Plugin):
context = Context({
'inaddr': reversename,
'zone': reversezone,
- 'nameservers': mcs_nameservers,
+ 'nameservers': reverse_nameservers,
})
self.filedata['%s.rev' % reversename] = self.templates['reversesoa'].render(context)