summaryrefslogtreecommitdiff
path: root/bin/taler-gv
diff options
context:
space:
mode:
Diffstat (limited to 'bin/taler-gv')
-rwxr-xr-xbin/taler-gv32
1 files changed, 23 insertions, 9 deletions
diff --git a/bin/taler-gv b/bin/taler-gv
index a63bfca..9e6693c 100755
--- a/bin/taler-gv
+++ b/bin/taler-gv
@@ -529,6 +529,27 @@ CURRENCY = "KUDOS"
def prepare(postgres_db_name):
"""Generate configuration, run-time blobs, instances, euFin accounts."""
+ def is_serving(check_url, tries=10):
+ for i in range(tries):
+ try:
+ print_nn(".")
+ # Raises if the service is not reachable.
+ response = requests.get(
+ check_url,
+ timeout=1
+ )
+ # The reverse proxy may return 500 if the
+ # end service is not ready, therefore this
+ # case should be tolerated.
+ response.raise_for_status()
+ except:
+ time.sleep(0.5)
+ if i == tries - 1:
+ return False
+ continue
+ break
+ return True
+
def fail(reason=None):
if reason:
print("ERROR:", reason)
@@ -1315,15 +1336,8 @@ def prepare(postgres_db_name):
print(" OK")
print_nn("Launching the exchange...")
subprocess.run(["systemctl", "--user", "start", "taler-local-exchange-httpd.service"])
- res = requests.get("https://exchange.demo.taler.net/")
- res_count = 0
- while res.status_code != 200:
- if res_count == 10:
- print("Exchange unreachable")
- sys.exit(1)
- res_count = res_count + 1
- time.sleep(1)
- res = requests.get("https://exchange.demo.taler.net/")
+ if not is_serving("https://exchange.demo.taler.net/"):
+ fail(f"Exchange did not start correctly.")
print(" OK")
print_nn("exchange-offline: signing key material...")
Command([