gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] branch master updated: fix syntax errors


From: gnunet
Subject: [taler-deployment] branch master updated: fix syntax errors
Date: Thu, 01 Jul 2021 17:49:38 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new a326dd2  fix syntax errors
a326dd2 is described below

commit a326dd208c45aadf67c0083756ba01fa4239bd8e
Author: ms <ms@taler.net>
AuthorDate: Thu Jul 1 17:49:34 2021 +0200

    fix syntax errors
---
 buildbot/check_tip_reserve.py | 88 ++++++++++++++-----------------------------
 1 file changed, 28 insertions(+), 60 deletions(-)

diff --git a/buildbot/check_tip_reserve.py b/buildbot/check_tip_reserve.py
index 9fa87bd..ba7ae7d 100755
--- a/buildbot/check_tip_reserve.py
+++ b/buildbot/check_tip_reserve.py
@@ -21,67 +21,35 @@ def expect_env(name):
         exit(1)
     return val
 
-def wait_merchant_up():
-    # Check it started correctly and it is ready to serve requests.
-    checks = 10
-    url = urljoin(MERCHANT_BACKEND_BASE_URL, "/config")
-    print("Check URL: {}".format(url))
-    while checks > 0:
-
-        try:
-            resp = requests.get(url, timeout=1.5)
-        except Exception:
-            print("Merchant unreachable")
-            sleep(1)
-            checks -= 1
-            continue
-
-        if resp.status_code != 200:
-            sleep(1)
-            checks -= 1
-            continue
-
-        # Ready.
-        print("Merchant is up and running")
-        return True
-
-    if checks == 0:
-        print("Merchant is not correctly serving requests.")
-        return False
-
 
 MERCHANT_BACKEND_BASE_URL = expect_env("TALER_ENV_MERCHANT_BACKEND")
-TALER_ENV_NAME = expect_env("TALER_ENV_NAME")
-TALER_CONFIG_CURRENCY = expect_env("TALER_CONFIG_CURRENCY")
 TALER_ENV_FRONTENDS_APITOKEN = expect_env("TALER_ENV_FRONTENDS_APITOKEN")
-authorization_header = {"Authorization": f"Bearer 
{TALER_ENV_FRONTENDS_APITOKEN}"}
-
-def request_tip_reserves():
-    resp = requests.get(
-        urljoin(MERCHANT_BACKEND_BASE_URL,
-                "instances/survey/private/reserves"),
-        headers = authorization_header
-    )
-
-    # Instance exists, we PATCH the auth just in case it changed.
-    if resp.status_code != 200:
-        report("merchant backend failed at providing a list of tip reserves!")
-        sys.exit(1)
-
-    reserves = resp.json().get("reserves")
-
-    if len(reserves) == 0:
-        report("merchant backend has NO tip reserves active!")
-        sys.exit(1)
-
-    total_amount = Amount.parse(reserves[0].get("committed_amount")
-    for item in reserves[1:]:
-        item_amount = Amount.parse(item.get("committed_amount"))
-        total_amount += item_amount
-
-    if total_amount.is_zero():
-        report("tip money reached zero")
-        sys.exit(1)
 
-    # FIXME, eventually, just check the largest amount left through
-    # all the reserves.
+resp = requests.get(
+    urljoin(MERCHANT_BACKEND_BASE_URL,
+            "instances/survey/private/reserves"),
+    headers = {"Authorization": f"Bearer {TALER_ENV_FRONTENDS_APITOKEN}"}
+)
+
+# Instance exists, we PATCH the auth just in case it changed.
+if resp.status_code != 200:
+    print("merchant backend failed at providing a list of tip reserves!")
+    exit(1)
+
+reserves = resp.json().get("reserves")
+if len(reserves) == 0:
+    print("merchant backend has NO tip reserves active!")
+    exit(1)
+
+total_amount = Amount.parse(reserves[0].get("committed_amount"))
+for item in reserves[1:]:
+    item_amount = Amount.parse(item.get("committed_amount"))
+    total_amount += item_amount
+
+if total_amount.is_zero():
+    print("tip money reached zero")
+    exit(1)
+
+# FIXME, eventually, just check the largest amount left through
+# all the reserves.
+print(f"Tip money is available: {total_amount}")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]