[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-deployment] branch master updated: Instances configuration with I
From: |
gnunet |
Subject: |
[taler-deployment] branch master updated: Instances configuration with IBAN. |
Date: |
Sat, 18 Sep 2021 10:57:24 +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 f2d4d37 Instances configuration with IBAN.
f2d4d37 is described below
commit f2d4d37a4edb86b7402c8ae4448ed4d543f742c9
Author: ms <ms@taler.net>
AuthorDate: Sat Sep 18 10:55:54 2021 +0200
Instances configuration with IBAN.
Basically patching what the prepare script set as
x-taler-bank for the blog shop (and default instance).
---
bin/taler-deployment-config-instances-iban | 51 ++++++++++--------------------
1 file changed, 17 insertions(+), 34 deletions(-)
diff --git a/bin/taler-deployment-config-instances-iban
b/bin/taler-deployment-config-instances-iban
index 8363221..d17eec5 100755
--- a/bin/taler-deployment-config-instances-iban
+++ b/bin/taler-deployment-config-instances-iban
@@ -66,30 +66,12 @@ TALER_ENV_FRONTENDS_APITOKEN =
expect_env("TALER_ENV_FRONTENDS_APITOKEN")
authorization_header = {"Authorization": f"Bearer
{TALER_ENV_FRONTENDS_APITOKEN}"}
-# Unused at the moment.
def ensure_instance(instance_id, name, payto_uris, auth):
resp = requests.get(
urljoin(MERCHANT_BACKEND_BASE_URL,
f"management/instances/{instance_id}"),
headers = authorization_header
)
-
- # Instance exists, we PATCH the auth just in case it changed.
- if resp.status_code == 200:
- if instance_id != "Tutorial":
- print(f"Patching (auth of) instance '{instance_id}'")
- patch_resp = requests.post(
- urljoin(MERCHANT_BACKEND_BASE_URL,
- f"management/instances/{instance_id}/auth"),
- json=auth,
- headers = authorization_header
- )
- if patch_resp.status_code < 200 or patch_resp.status_code >= 300:
- print(f"Failed to update auth of '{instance_id}', backend
responds: {patch_resp.status_code}/{patch_resp.text}")
- exit(1)
- return
-
- print(f"Instance '{instance_id}' not found, trying to create it.")
req = dict(
id=instance_id,
name=name,
@@ -103,16 +85,23 @@ def ensure_instance(instance_id, name, payto_uris, auth):
default_pay_delay=dict(d_ms="forever"),
auth=auth,
)
- create_resp = requests.post(
- urljoin(MERCHANT_BACKEND_BASE_URL, "management/instances"),
+ http_method = requests.post
+ endpoint = "management/instances"
+ # Instance exists, patching it.
+ if resp.status_code == 200:
+ if instance_id != "Tutorial":
+ print(f"Patching instance '{instance_id}'")
+ http_method = requests.patch
+ endpoint = f"management/instances/{instance_id}"
+ resp = http_method(
+ urljoin(MERCHANT_BACKEND_BASE_URL, endpoint),
json=req,
headers = authorization_header
)
- if create_resp.status_code < 200 or create_resp.status_code >= 300:
- print(f"Could not create instance '{instance_id}', backend responds:
{create_resp.status_code}/{create_resp.text}")
+ if resp.status_code < 200 or resp.status_code >= 300:
+ print(f"Could not create (or patch) instance '{instance_id}', backend
responds: {resp.status_code}/{resp.text}")
exit(1)
-
def is_merchant_running():
for proc in psutil.process_iter():
if proc.name() == "taler-merchant-httpd" and proc.username() ==
getuser():
@@ -163,23 +152,17 @@ def ensure_default_instance():
# Native process can be terminated now.
merchant.terminate()
merchant.wait()
- print("Merchant terminated, restarting it via ARM now.")
-
- # Restarting the official ARM merchant.
- if merchant_was_running:
- 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.
-if not wait_merchant_up():
- system("taler-deployment-arm -k taler-merchant")
- exit(1)
+system("taler-deployment-arm -s")
+system("taler-deployment-arm -i taler-merchant")
+wait_merchant_up()
ensure_instance(
"blog",
name="Blog",
-
payto_uris=[f"payto://x-taler-bank/bank.{TALER_ENV_NAME}.taler.net/{ibans.get('blog')}"],
+
payto_uris=[f"payto://sepa/bank.{TALER_ENV_NAME}.taler.net/{ibans.get('blog')}"],
auth=dict(method="token", token=TALER_ENV_FRONTENDS_APITOKEN),
)
+system("taler-deployment-stop")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-deployment] branch master updated: Instances configuration with IBAN.,
gnunet <=