samba_upgradedns: Do not print confusing logs about missing .zone files
authorAndrew Bartlett <abartlet@samba.org>
Mon, 23 Nov 2020 21:15:43 +0000 (10:15 +1300)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Nov 2020 08:16:04 +0000 (08:16 +0000)
samba_upgradedns prints confusing logs about upgrading zone files
and automatically creating DNS zones when the zone already exists.

We need to move the logging to later when we know we what we are
using the parsed information for.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14580

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Nov 26 08:16:04 UTC 2020 on sn-devel-184

source4/scripting/bin/samba_upgradedns

index 4ac131ef1e7c0040499e0b2cb5d88e7ee830bde3..308dbb06db8ca22a3b1d282a14153d192cdf637d 100755 (executable)
@@ -331,11 +331,9 @@ if __name__ == '__main__':
             serial = int(rrset[0].serial)
         except Exception as e:
             logger.warn("Error parsing DNS data from '%s' (%s)" % (paths.dns, str(e)))
-            logger.warn("DNS records will be automatically created")
             autofill = True
     else:
-        logger.info("No zone file %s" % paths.dns)
-        logger.warn("DNS records will be automatically created")
+        logger.info("No zone file %s (normal)" % paths.dns)
         autofill = True
 
     # Create DNS partitions if missing and fill DNS information
@@ -373,6 +371,9 @@ if __name__ == '__main__':
                               dnsadmins_sid, FILL_FULL)
 
         logger.info("Populating DNS partitions")
+        if autofill:
+            logger.warn("DNS records will be automatically created")
+
         fill_dns_data_partitions(ldbs.sam, domainsid, site, domaindn, forestdn,
                              dnsdomain, dnsforest, hostname, hostip, hostip6,
                              domainguid, ntdsguid, dnsadmins_sid,