summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Hostbase
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-10-16 18:34:04 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-10-16 18:34:04 +0000
commite47c5a3396d61520d2bf0432ae88793d56c6d3da (patch)
treeecc4643c1775ae4f74ce0ac7f3ab1f27c686d4d1 /src/lib/Server/Hostbase
parent3fec8ec4bd7c60b10685a2a911fd4a84c546b896 (diff)
downloadbcfg2-e47c5a3396d61520d2bf0432ae88793d56c6d3da.tar.gz
bcfg2-e47c5a3396d61520d2bf0432ae88793d56c6d3da.tar.bz2
bcfg2-e47c5a3396d61520d2bf0432ae88793d56c6d3da.zip
added support for changing hostname from the web interface
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2436 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Hostbase')
-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 ->