+ try:
+ f = open('/tmp/log', 'a')
+ dns.resolver.query('%s.%s.' % (name, config.dns.domains[0]), 'A')
+ # If the hostname didn't exist, it would have thrown an
+ # exception by now - error out
+ raise InvalidInput('name', name, 'Name is already taken.')
+ except dns.resolver.NXDOMAIN, e: