diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-09-21 21:57:44 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-09-21 21:57:44 +0000 |
commit | ec7999775cc74f3eee97b84eb4e4ef9341da594b (patch) | |
tree | f67c8f956a03010badd88b775446d3e92eb0621e /src/lib/Server/Hostbase/hostbase/views.py | |
parent | 1e2efbb211c375d384a17f4ff7bccba366202076 (diff) | |
download | bcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.tar.gz bcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.tar.bz2 bcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.zip |
tweaks to dhcp generation
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2297 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Hostbase/hostbase/views.py')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/views.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index c45f187d8..8d7fd3d3a 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -450,6 +450,12 @@ def new(request): """Function for creating a new host in hostbase Data is validated before committed to the database""" if request.GET.has_key('sub'): + try: + Host.objects.get(hostname=request.POST['hostname']) + return render_to_response('errors.html', + {'failures': ['%s already exists in hostbase' % request.POST['hostname']]}) + except: + pass if not validate(request, True): host = Host() # this is the stuff that validate() should take care of @@ -459,6 +465,8 @@ def new(request): for attrib in attribs: if request.POST.has_key(attrib): host.__dict__[attrib] = request.POST[attrib] + if request.POST.has_key('expiration_date'): + host.__dict__['expiration_date'] = date(2000, 1, 1) host.status = 'active' host.save() else: |