[ -e $PID_OSRF_PYTHON ] && rm $PID_OSRF_PYTHON;
OPT_LOCAL=""
[ "$OSRF_HOSTNAME" = "localhost" ] && OPT_LOCAL="-l"
+ set +e # Ignore errors for NXDOMAIN
opensrf.py -p $OPT_PID_DIR -f $OPT_CONFIG -a stop_all $OPT_LOCAL
+ set -e # Errors matter again
sleep 1;
return 0;
}
import sys, getopt, os, signal
import osrf.system, osrf.server, osrf.app, osrf.set, osrf.json
+import dns.resolver
def do_help():
'''
global domain
global settings
- # connect to the OpenSRF network
- osrf.system.System.net_connect(
- config_file = config_file, config_context = config_ctx)
+ try:
+ # connect to the OpenSRF network
+ osrf.system.System.net_connect(
+ config_file = config_file, config_context = config_ctx)
+ except dns.resolver.NXDOMAIN:
+ dnsfail = """
+ERROR: Could not initialize the OpenSRF Python environment. A DNS query
+failed to resolve the network address of the XMPP server.
+"""
+ sys.exit(dnsfail)
if as_localhost:
domain = 'localhost'