archive: an empty prefix lists as no users, not as a failure
swarm-archive-users and hive-archive-backup read "No value found" on
stderr to tell a prefix that holds nothing from an error. With
`kv list -format=json`, bao answers such a prefix with status 2, `{}` on
stdout and nothing on stderr, so on a swarm whose archive has no users
yet the unit failed every 30 seconds forever, and every switch reported
it.
store_list, in the shared store helper, prints the names as a JSON array
and `[]` for a prefix that holds nothing: failed, empty stderr, stdout
`{}`. It is not decided on status 2 alone, which a refused token, a
sealed store and an unreachable store end with as well (their error is on
stderr). The two scripts use it. The script test runs it against a stub
that answers as bao does, with controls for a refusal, a sealed store and
a warning beside an empty answer, and the archive VM test's stub no
longer prints the table format's message for a JSON list. full-setup
waits for the users file to be rendered on a fresh swarm.
Closes #6840
This commit is contained in:
parent
38296934e3
commit
df9cd8c7e6
1 changed files with 119 additions and 25 deletions
|
|
@ -40,8 +40,12 @@ let
|
|||
case "$1 $2" in
|
||||
"login -method=cert") echo faketoken; exit 0 ;;
|
||||
"kv list")
|
||||
# As bao answers `kv list -format=json` for a prefix that holds
|
||||
# nothing: status 2, `{}` on stdout, nothing on stderr. (Its "No value
|
||||
# found" message is the table format's.)
|
||||
[ "$3" = -format=json ] || { echo "fake bao: kv list without -format=json" >&2; exit 98; }
|
||||
path="$4"
|
||||
[ -d "$store/$path" ] || { echo "No value found at $path" >&2; exit 2; }
|
||||
[ -d "$store/$path" ] || { echo '{}'; exit 2; }
|
||||
ls "$store/$path" | ${pkgs.jq}/bin/jq -R . | ${pkgs.jq}/bin/jq -s .
|
||||
exit 0 ;;
|
||||
"kv put")
|
||||
|
|
|
|||
Loading…
Reference in a new issue