summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py12
-rw-r--r--src/lib/Server/Hostbase/templates/batchadd.tmpl4
2 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py
index f866e1b31..495f1e8ac 100644
--- a/src/lib/Server/Hostbase/hostbase/views.py
+++ b/src/lib/Server/Hostbase/hostbase/views.py
@@ -163,9 +163,14 @@ def edit(request, host_id):
"""Edit general host information
Data is validated before being committed to the database"""
# fix bug when ip address changes, update the dns info appropriately
-
+ changename = False
if request.GET.has_key('sub'):
host = Host.objects.get(id=host_id)
+ if request.POST['hostname'] != host.hostname:
+ oldhostname = host.hostname.split(".")[0]
+ host.hostname = request.POST['hostname']
+ host.save()
+ changename = True
interfaces = host.interface_set.all()
if not validate(request, False, host_id):
if (request.POST.has_key('outbound_smtp')
@@ -211,6 +216,11 @@ def edit(request, host_id):
if name.name.split(".")[0].endswith('-%s' % oldtype):
name.name = name.name.replace('-%s' % oldtype, '-%s' % inter.hdwr_type)
name.save()
+ if changename:
+ for name in names:
+ if name.name.startswith(oldhostname):
+ name.name = name.name.replace(oldhostname, host.hostname.split(".")[0])
+ name.save()
if request.POST['%dip_addr' % inter.id]:
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
diff --git a/src/lib/Server/Hostbase/templates/batchadd.tmpl b/src/lib/Server/Hostbase/templates/batchadd.tmpl
index 730ab08f8..5f482cb6c 100644
--- a/src/lib/Server/Hostbase/templates/batchadd.tmpl
+++ b/src/lib/Server/Hostbase/templates/batchadd.tmpl
@@ -13,15 +13,17 @@ outbound_smtp ->
primary_user ->
administrator ->
location ->
-expiration_date -> XXXX-XX-XX
+expiration_date -> YYYY-MM-DD
comments ->
mac_addr ->
+hdwr_type ->
ip_addr ->
#ip_addr ->
cname ->
#cname ->
#mac_addr ->
+#hdwr_type ->
#ip_addr ->
#cname ->