Skip to content
Snippets Groups Projects
Commit c4195a01 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Merge remote-tracking branch 'origin/master' into 297.upgrade-tahoe-lafs-storage-server

parents a521e884 f4b364cc
Branches
No related tags found
1 merge request!51Upgrade Tahoe-LAFS on the storage servers
{ callPackage }:
let
leasereport = import ./leasereport-repo.nix;
# Pin a particular version of haskell.nix. The particular version isn't
# special. It's just recent at the time this expression was written and it
# is known to work with LeaseReport. It could be bumped if necessary but
# this would probably only happen as a result of bumping the resolver in
# stack.yaml.
haskellNixSrc = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/f6663a8449f5e4a7393aa24601600c8f6e352c97.tar.gz;
in
(callPackage "${leasereport}/nix" { }).LeaseReport.components.exes.LeaseReport
(callPackage "${leasereport}/nix" { inherit haskellNixSrc; }).LeaseReport.components.exes.LeaseReport
......@@ -12,11 +12,11 @@ from json import dumps
from time import sleep
def main():
if len(argv) != 4:
if len(argv) != 5:
raise SystemExit(
"usage: %s <client api root> <issuer api root> <voucher>",
"usage: %s <client api root> <client api token path> <issuer api root> <voucher>",
)
clientAPIRoot, issuerAPIRoot, voucher = argv[1:]
clientAPIRoot, clientAPITokenPath, issuerAPIRoot, voucher = argv[1:]
if not clientAPIRoot.endswith("/"):
clientAPIRoot += "/"
if not issuerAPIRoot.endswith("/"):
......@@ -24,11 +24,16 @@ def main():
zkapauthz = clientAPIRoot + "storage-plugins/privatestorageio-zkapauthz-v1"
with open(clientAPITokenPath) as p:
clientAPIToken = p.read().strip()
# Submit a charge to the issuer (which is also the PaymentServer).
charge_response = post(
issuerAPIRoot + "v1/stripe/charge",
dumps(charge_json(voucher)),
headers={"content-type": "application/json"},
headers={
"content-type": "application/json",
},
)
charge_response.raise_for_status()
......@@ -36,6 +41,11 @@ def main():
response = put(
zkapauthz + "/voucher",
dumps({"voucher": voucher}),
headers={
"content-type": "application/json",
"authorization": "tahoe-lafs " + clientAPIToken,
}
)
if response.status_code // 100 != 2:
print("Unexpected response: {}".format(response.content))
......@@ -43,7 +53,12 @@ def main():
# Poll the vouchers list for a while to see it get redeemed.
def find_redeemed_voucher():
response = get(zkapauthz + "/voucher/" + voucher)
response = get(
zkapauthz + "/voucher/" + voucher,
headers={
"authorization": "tahoe-lafs " + clientAPIToken,
},
)
response.raise_for_status()
actual = response.json()
print("Actual response: {}".format(actual))
......
......@@ -230,7 +230,7 @@ in {
#
# Storage appears to be working so try to get a client to speak with it.
#
${runOnNode "client" [ run-client introducerFURL issuerURL ]}
${runOnNode "client" [ run-client "/tmp/client" introducerFURL issuerURL ]}
$client->waitForOpenPort(3456);
# Make sure the fake Stripe API server is ready for requests.
......@@ -245,7 +245,13 @@ in {
# Get some ZKAPs from the issuer.
eval {
${runOnNode "client" [ get-passes "http://127.0.0.1:3456" issuerURL voucher ]}
${runOnNode "client" [
get-passes
"http://127.0.0.1:3456"
"/tmp/client/private/api_auth_token"
issuerURL
voucher
]}
} or do {
my ($code, $log) = $client->execute('cat /tmp/stdout /tmp/stderr');
$client->log($log);
......
......@@ -12,7 +12,7 @@ from subprocess import check_output
from configparser import ConfigParser
def main():
(introducerFURL, issuerURL) = argv[1:]
(nodePath, introducerFURL, issuerURL) = argv[1:]
run(["tahoe", "--version"])
run([
......@@ -21,7 +21,7 @@ def main():
"--shares-happy", "1",
"--shares-total", "1",
"--introducer", introducerFURL,
"/tmp/client",
nodePath,
])
# Add necessary ZKAPAuthorizer configuration bits.
......
......@@ -4,6 +4,6 @@ in
pkgs.fetchFromGitHub {
owner = "PrivateStorageio";
repo = "ZKAPAuthorizer";
rev = "7b4796470764f47f6b2f57d7678cc2311e5bd18e";
sha256 = "1b5z7mha8sak46b2sxdd44hqc0a1wx7frcydzgzs25ncq4a516aa";
rev = "17d66c052bfd08f8d00301cc431a83c70f05db0f";
sha256 = "10ss41lk2mlb3ys7b8dc9dkcdiabkvi8clklkm75llk0g5bkvvss";
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment