summaryrefslogtreecommitdiff
path: root/bin/taler-deployment-config-instances
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-05-28 18:27:08 +0200
committerMS <ms@taler.net>2021-05-28 18:27:08 +0200
commit97705eca5310cfef2dbe44df691f01dbe36ab0af (patch)
tree22b62209a6fde73214b895fdbfb228daa23789db /bin/taler-deployment-config-instances
parentefcc4c7015181e57159920695ba86d596b5b4e5d (diff)
downloaddeployment-97705eca5310cfef2dbe44df691f01dbe36ab0af.tar.gz
deployment-97705eca5310cfef2dbe44df691f01dbe36ab0af.tar.bz2
deployment-97705eca5310cfef2dbe44df691f01dbe36ab0af.zip
fix waiting for merchant to be up
Diffstat (limited to 'bin/taler-deployment-config-instances')
-rwxr-xr-xbin/taler-deployment-config-instances53
1 files changed, 28 insertions, 25 deletions
diff --git a/bin/taler-deployment-config-instances b/bin/taler-deployment-config-instances
index 555daf8..7153287 100755
--- a/bin/taler-deployment-config-instances
+++ b/bin/taler-deployment-config-instances
@@ -24,11 +24,30 @@ def expect_env(name):
exit(1)
return val
-def wait_merchant():
- for proc in psutil.process_iter():
- if proc.name() == "taler-merchant-httpd" and proc.username == getuser():
- break
- sleep(1)
+def wait_merchant_up():
+ # Check it started correctly and it is ready to serve requests.
+ checks = 10
+ while checks > 0:
+
+ try:
+ resp = requests.get(urljoin(MERCHANT_BACKEND_BASE_URL, "/config"), timeout=1.5)
+ except Exception:
+ sleep(1)
+ checks -= 1
+ continue
+
+ if resp.status_code != 200:
+ sleep(1)
+ checks -= 1
+ continue
+
+ # Ready.
+ break
+
+ if checks == 0:
+ print("Could not start the merchant (with TALER_MERCHANT_TOKEN in the env).")
+ exit(1)
+
MERCHANT_BACKEND_BASE_URL = expect_env("TALER_ENV_MERCHANT_BACKEND")
TALER_ENV_NAME = expect_env("TALER_ENV_NAME")
@@ -111,25 +130,7 @@ def ensure_default_instance():
# Start the merchant natively.
merchant = Popen(["taler-merchant-httpd"], env=env_with_token)
- # Check it started correctly and it is ready to serve requests.
- checks = 10
- while checks > 0:
-
- try:
- resp = requests.get(urljoin(MERCHANT_BACKEND_BASE_URL, "/config"), timeout=1.5)
- except Exception:
- sleep(1)
- checks -= 1
- continue
-
- if resp.status_code != 200:
- sleep(1)
- checks -= 1
- continue
-
- if checks == 0:
- print("Could not start the merchant (with TALER_MERCHANT_TOKEN in the env).")
- exit(1)
+ wait_merchant_up()
ensure_instance(
"default",
@@ -145,7 +146,9 @@ def ensure_default_instance():
system("taler-deployment-arm -i taler-merchant")
ensure_default_instance()
-wait_merchant()
+# Needs to wait here since the merchant got lastly restarted via ARM,
+# in the previous operation.
+wait_merchant_up()
ensure_instance(
"blog",