From 55a6377b129391e0dbd3ef5a2ca93b6db84cd59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Fri, 20 Sep 2024 18:35:22 +0200 Subject: [PATCH] Ignore errors of `garage key import` --- fediversity/garage.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fediversity/garage.nix b/fediversity/garage.nix index 2c3e006..9822da7 100644 --- a/fediversity/garage.nix +++ b/fediversity/garage.nix @@ -52,7 +52,8 @@ let ${escapeShellArg bucket} --key ${escapeShellArg key} ''; ensureKeyScriptFn = key: {id, secret, ensureAccess}: '' - garage key import --yes -n ${escapeShellArg key} ${escapeShellArg id} ${escapeShellArg secret} + ## FIXME: Check whether the key exist and skip this step if that is the case. Get rid of this `|| :` + garage key import --yes -n ${escapeShellArg key} ${escapeShellArg id} ${escapeShellArg secret} || : ${concatMapAttrs (ensureAccessScriptFn key) ensureAccess} ''; ensureKeysScript = concatMapAttrs ensureKeyScriptFn cfg.ensureKeys; @@ -197,7 +198,8 @@ in # XXX: this is a hack because we want to write to the buckets here but we're not guaranteed any access keys # TODO: generate this key here rather than using a well-known key - garage key import --yes -n tmp ${snakeoil_key.id} ${snakeoil_key.secret} + # TODO: if the key already exists, we get an error; hacked with this `|| :` which needs to be removed + garage key import --yes -n tmp ${snakeoil_key.id} ${snakeoil_key.secret} || : export AWS_ACCESS_KEY_ID=${snakeoil_key.id}; export AWS_SECRET_ACCESS_KEY=${snakeoil_key.secret};