ud-generate: No longer expand $ in dnsZoneEntry data to a \n\t.
[mirror/userdir-ldap.git] / ud-generate
index eb13678..27088e9 100755 (executable)
@@ -772,16 +772,13 @@ def GenDNS(accounts, File):
             for z in a["dnsZoneEntry"]:
                Split = z.lower().split()
                if Split[1].lower() == 'in':
-                  for y in range(0, len(Split)):
-                     if Split[y] == "$":
-                        Split[y] = "\n\t"
                   Line = " ".join(Split) + "\n"
                   F.write(Line)
-     
+
                   Host = Split[0] + DNSZone
                   if BSMTPCheck.match(Line) != None:
                      F.write("; Has BSMTP\n")
-     
+
                   # Write some identification information
                   if not RRs.has_key(Host):
                      if Split[2].lower() in ["a", "aaaa"]:
@@ -793,7 +790,7 @@ def GenDNS(accounts, File):
                else:
                   Line = "; Err %s"%(str(Split))
                   F.write(Line)
-     
+
             F.write("\n")
          except Exception, e:
             F.write("; Errors:\n")
@@ -1269,11 +1266,15 @@ last = sorted_mods[-1][1]['reqEnd'][0].split('.')[0]
 if 'UD_GENERATEDIR' in os.environ:
    GenerateDir = os.environ['UD_GENERATEDIR']
 
-cache_last_mod = [0,0]
+cache_last_mod = 0
 
 try:
    fd = open(os.path.join(GenerateDir, "last_update.trace"), "r")
    cache_last_mod=fd.read().split()
+   try:
+      cache_last_mod = cache_last_mod[0]
+   except IndexError:
+      pass
    fd.close()
 except IOError, e:
    if e.errno == errno.ENOENT:
@@ -1281,7 +1282,7 @@ except IOError, e:
    else:
       raise e
 
-if cache_last_mod[0] >= last:
+if cache_last_mod >= last:
    fd = open(os.path.join(GenerateDir, "last_update.trace"), "w")
    fd.write("%s\n%s\n" % (last, int(time.time())))
    fd.close()
@@ -1310,15 +1311,15 @@ try:
       sys.stderr.write("Could not acquire lock %s.\n"%(lockf))
       sys.exit(1)
 
+   tracefd = open(os.path.join(GenerateDir, "last_update.trace"), "w")
    generate_all(GenerateDir, l)
+   tracefd.write("%s\n%s\n" % (last, int(time.time())))
+   tracefd.close()
 
 finally:
    if lock is not None:
       lock.release()
 
-fd = open(os.path.join(GenerateDir, "last_update.trace"), "w")
-fd.write("%s\n%s\n" % (last, int(time.time())))
-fd.close()
 
 # vim:set et:
 # vim:set ts=3: