summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--selftest/knownfail.d/usage2
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate20
2 files changed, 16 insertions, 6 deletions
diff --git a/selftest/knownfail.d/usage b/selftest/knownfail.d/usage
index 0e125c6317d..222f2da1bec 100644
--- a/selftest/knownfail.d/usage
+++ b/selftest/knownfail.d/usage
@@ -4,8 +4,6 @@ samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_rebuildextendedd
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_renamedc.none.
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_repl_cleartext_pwd_py.none.
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_rodcdns.none.
-samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_samba_dnsupdate.none.
-samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_samba_dnsupdate_.none.
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_sambadowngradedatabase.none.
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_samba_gpupdate.none.
samba.tests.usage.samba.tests.usage.PythonScriptUsageTests.test_samba_gpupdate_.none.
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index 9d45de59fd6..cc380c0d204 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -60,7 +60,7 @@ default_ttl = 900
am_rodc = False
error_count = 0
-parser = optparse.OptionParser("samba_dnsupdate")
+parser = optparse.OptionParser("samba_dnsupdate [options]")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
parser.add_option_group(options.VersionOptions(parser))
@@ -98,8 +98,9 @@ IPs = opts.current_ip or samba.interface_ips(lp, bool(all_interfaces)) or []
nsupdate_cmd = lp.get('nsupdate command')
dns_zone_scavenging = lp.get("dns zone scavenging")
-if not IPs:
- print("No IP interfaces - skipping DNS updates")
+if len(IPs) == 0:
+ print("No IP interfaces - skipping DNS updates\n")
+ parser.print_usage()
sys.exit(0)
rpc_server_ip = opts.rpc_server_ip or IPs[0]
@@ -715,7 +716,18 @@ if 'SOCKET_WRAPPER_DIR' not in os.environ:
krb5conf = lp.private_path('krb5.conf')
os.environ['KRB5_CONFIG'] = krb5conf
-file = open(dns_update_list, "r")
+try:
+ file = open(dns_update_list, "r")
+except OSError as e:
+ if opts.update_cache:
+ print("The specified update list does not exist")
+ else:
+ print("The server update list was not found, "
+ "and --update-list was not provided.")
+ print(e)
+ print()
+ parser.print_usage()
+ sys.exit(1)
if opts.nosubs:
sub_vars = {}