Sort HostAttrs - this isn't important now, but will let us do things
[mirror/userdir-ldap.git] / ud-generate
index 158c3f6..2319787 100755 (executable)
@@ -761,7 +761,6 @@ def GenDNS(File):
             x[1].has_key("sshRSAHostKey") == 0:
             continue
 
-         print "%s %s" % (GetAttr(x, "hostname"), IsDebianHost.match(GetAttr(x, "hostname")))
          if IsDebianHost.match(GetAttr(x, "hostname")) is not None:
             continue
 
@@ -853,8 +852,8 @@ def ExtractDNSInfo(x):
 
    return DNSInfo
 
-# Generate the DNS SSHFP records
-def GenSSHFP(File):
+# Generate the DNS records
+def GenZoneRecords(File):
    F = None
    try:
       F = open(File + ".tmp", "w")
@@ -1084,6 +1083,8 @@ HostAttrs    = l.search_s(HostBaseDn, ldap.SCOPE_ONELEVEL, "objectClass=debianSe
 if HostAttrs == None:
    raise UDEmptyList, "No Hosts"
 
+HostAttrs.sort(lambda x, y: cmp((GetAttr(x, "hostname")).lower(), (GetAttr(y, "hostname")).lower()))
+
 # Generate global things
 GlobalDir = GenerateDir + "/"
 GenDisabledAccounts(GlobalDir + "disabled-accounts")
@@ -1184,7 +1185,7 @@ for host in HostAttrs:
 
    if 'DNS' in ExtraList:
       GenDNS(OutDir + "dns-zone")
-      GenSSHFP(OutDir + "dns-sshfp")
+      GenZoneRecords(OutDir + "dns-sshfp")
 
    if 'AUTHKEYS' in ExtraList:
       DoLink(GlobalDir, OutDir, "authorized_keys")