summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-06-27 16:57:21 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-07-05 01:05:20 +0000
commit075bf608369896e1f1475a6ecb99118637c73698 (patch)
tree998a27850e63cca7b257ae7fd75b9e522f99bbdc /source4
parentc78eef6810ae5a7a48f126ec9ede2b76a77fdb0c (diff)
downloadsamba-075bf608369896e1f1475a6ecb99118637c73698.tar.gz
s4/scripting/samba_dnsupdate: print usage with no arguments
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate20
1 files changed, 16 insertions, 4 deletions
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 = {}