offline = fields.getvalue('offline')
-# Strip zone
-hostname = hostname.strip()
-if hostname.endswith(ZONE):
- hostname = hostname[:-len(ZONE)]
-
try:
# check username
user_info = pwd.getpwnam(username) # returns a key error if the user does not exist
if re.match(r'[-0-9a-z]+(\.[-0-9a-z]+)*$', hostname) is None:
raise RuntimeError('Invalid host name')
+ # strip zone
+ hostname = hostname.strip()
+ if hostname.endswith(ZONE):
+ hostname = hostname[:-len(ZONE)]
+
# check IP address
ip = ipaddr.IPAddress(myip) # throws axception if the IP address is not valid
if isinstance(ip, ipaddr.IPv4Address):