summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-05-29 08:53:11 +0200
committerMS <ms@taler.net>2021-05-29 08:53:11 +0200
commit2877920de2dc6c544ca3ff3b247fcd06efb292a8 (patch)
treec28a39708c88618cddccf12ba25ed3957d5b93dd
parent8a4f18ec74e0d241662ba71db327d9b69f2dba82 (diff)
downloaddeployment-2877920de2dc6c544ca3ff3b247fcd06efb292a8.tar.gz
deployment-2877920de2dc6c544ca3ff3b247fcd06efb292a8.tar.bz2
deployment-2877920de2dc6c544ca3ff3b247fcd06efb292a8.zip
Improve process termination
-rwxr-xr-xbin/taler-deployment-config-instances20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/taler-deployment-config-instances b/bin/taler-deployment-config-instances
index ad1feec..27c5c17 100755
--- a/bin/taler-deployment-config-instances
+++ b/bin/taler-deployment-config-instances
@@ -47,11 +47,11 @@ def wait_merchant_up():
# Ready.
print("Merchant is up and running")
- break
+ return True
if checks == 0:
- print("Could not start the merchant (with TALER_MERCHANT_TOKEN in the env).")
- exit(1)
+ print("Merchant is not correctly serving requests.")
+ return False
MERCHANT_BACKEND_BASE_URL = expect_env("TALER_ENV_MERCHANT_BACKEND")
@@ -140,7 +140,10 @@ def ensure_default_instance():
# Start the merchant natively.
merchant = Popen(["taler-merchant-httpd"], env=env_with_token)
- wait_merchant_up()
+ if not wait_merchant_up():
+ merchant.terminate()
+ merchant.wait()
+ exit(1)
print("Merchant started successfully, creating the default instance now.")
ensure_instance(
@@ -149,17 +152,20 @@ def ensure_default_instance():
payto_uris=[f"payto://x-taler-bank/bank.{TALER_ENV_NAME}.taler.net/Taler"],
auth=dict(method="token", token=TALER_ENV_FRONTENDS_APITOKEN)
)
-
+ # Native process can be terminated now.
merchant.terminate()
merchant.wait()
print("Merchant terminated, restarting it via ARM now.")
-
+ # Restarting the official ARM merchant.
system("taler-deployment-arm -i taler-merchant")
ensure_default_instance()
+
# Needs to wait here since the merchant got lastly restarted via ARM,
# in the previous operation.
-wait_merchant_up()
+if not wait_merchant_up():
+ system("taler-deployment-arm -k taler-merchant")
+ exit(1)
ensure_instance(
"blog",