diff --git a/fediversity/garage.nix b/fediversity/garage.nix index 2c3e0064..9822da7e 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};