diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-10-10 19:54:46 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-10-10 19:54:46 +0000 |
commit | 998b31229cdd91a1fd0610596e83addfe28e6e0c (patch) | |
tree | fb1aca14ea14bf54f0b3f3cd7bb910eeaa4c6e23 /src/lib/Server/Hostbase | |
parent | a8a0e8d58c2058b281c298cde301b3eeb02495e2 (diff) | |
download | bcfg2-998b31229cdd91a1fd0610596e83addfe28e6e0c.tar.gz bcfg2-998b31229cdd91a1fd0610596e83addfe28e6e0c.tar.bz2 bcfg2-998b31229cdd91a1fd0610596e83addfe28e6e0c.zip |
fixed bug in host edit page
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2429 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Hostbase')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/views.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index b49af90c7..a20faf6d0 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -201,19 +201,20 @@ def edit(request, host_id): name.name = newname name.save() for ip in ips: - oldip = ip.ip_addr - ip.ip_addr = request.POST['ip_addr%d' % ip.id] - ip.save() - oldname = "-".join([host.hostname.split(".", 1)[0], - oldip.split(".")[2]]) - oldname += "." + host.hostname.split(".", 1)[1] - newname = "-".join([host.hostname.split(".", 1)[0], - ip.ip_addr.split(".")[2]]) - newname += "." + host.hostname.split(".", 1)[1] - if Name.objects.filter(name=oldname): - name = Name.objects.get(name=oldname, ip=ip.id) - name.name = newname - name.save() + if not ip.ip_addr == request.POST['ip_addr%d' % ip.id]: + oldip = ip.ip_addr + ip.ip_addr = request.POST['ip_addr%d' % ip.id] + ip.save() + oldname = "-".join([host.hostname.split(".", 1)[0], + oldip.split(".")[2]]) + oldname += "." + host.hostname.split(".", 1)[1] + newname = "-".join([host.hostname.split(".", 1)[0], + ip.ip_addr.split(".")[2]]) + newname += "." + host.hostname.split(".", 1)[1] + if Name.objects.filter(name=oldname): + name = Name.objects.get(name=oldname, ip=ip.id) + name.name = newname + 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: |