diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-09-06 11:20:15 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-09-06 11:20:15 +0200 |
commit | b0f3d60fec149ffee23872bd0e9290bebdf679e3 (patch) | |
tree | 0a0bd752ac82472fdfd4e6fb20d7420e32b3d639 /bin/taler-merchant-demos | |
parent | 30bad63dacae699e5256fd6d6e27a968ad6cce30 (diff) | |
parent | 9cf423b539c24bf2c210f5a5dd997664f88727d6 (diff) | |
download | taler-merchant-demos-b0f3d60fec149ffee23872bd0e9290bebdf679e3.tar.gz taler-merchant-demos-b0f3d60fec149ffee23872bd0e9290bebdf679e3.tar.bz2 taler-merchant-demos-b0f3d60fec149ffee23872bd0e9290bebdf679e3.zip |
merge
Diffstat (limited to 'bin/taler-merchant-demos')
-rwxr-xr-x | bin/taler-merchant-demos | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/bin/taler-merchant-demos b/bin/taler-merchant-demos index cf56d81..7ed69d7 100755 --- a/bin/taler-merchant-demos +++ b/bin/taler-merchant-demos @@ -27,7 +27,7 @@ import argparse import sys import os import site -from taler.util.talerconfig import TalerConfig +from taler.util.talerconfig import TalerConfig, ConfigurationError LOGGER = logging.getLogger(__name__) # No perfect match to our logging format, but good enough ... @@ -60,7 +60,11 @@ def handle_serve_uwsgi(config, whichShop): params.extend(["--chmod-socket="+mode]) os.makedirs(os.path.dirname(spec), exist_ok=True) logging.info("launching uwsgi with argv %s", params[1:]) - os.execlp(*params) + try: + os.execlp(*params) + except: + sys.stderr.write("Failed to start uwsgi. Please make sure to install uwsgi for Python3.") + sys.exit(1) ## # This function interprets the 'serve-http' subcommand. @@ -69,15 +73,22 @@ def handle_serve_uwsgi(config, whichShop): # @param args command line options. def handle_serve_http(config, whichShop, port=None): if port is None: - port = config[whichShop]["http_port"].value_int(required=True) + try: + port = config[whichShop]["http_port"].value_int(required=True) + except ConfigurationError as ce: + print(ce) + exit(1) spec = ":%d" % (port,) - os.execlp("uwsgi", "uwsgi", - "--master", - "--die-on-term", - "--log-format", UWSGI_LOGFMT, - "--http", spec, - "--need-app", - "--module", "talermerchantdemos.{}:app".format(whichShop)) + try: + os.execlp("uwsgi", "uwsgi", + "--master", + "--die-on-term", + "--log-format", UWSGI_LOGFMT, + "--http", spec, + "--module", "talermerchantdemos.{}:app".format(whichShop)) + except: + sys.stderr.write("Failed to start uwsgi. Please make sure to install uwsgi for Python3.") + sys.exit(1) @click.command("Global shop launcher") @click.option("--config", help="Configuration file", required=False) @@ -94,7 +105,7 @@ def demos(config, serve_http, port, serve_uwsgi, which_shop): config_obj = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE")) if serve_http: # port was given handle_serve_http(config_obj, which_shop, port) - return - handle_serve_uwsgi(config_obj, which_shop) + else: + handle_serve_uwsgi(config_obj, which_shop) demos() |