summaryrefslogtreecommitdiff
path: root/src/ostree
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2020-06-17 00:22:49 +0000
committerColin Walters <walters@verbum.org>2020-06-17 00:33:47 +0000
commit36258036ae1388c728eec0237b283e225f64a7b1 (patch)
tree1616ed7bc9d2e7ae0b946c01e894c0b5e39e65c2 /src/ostree
parentb2dde24f00699822c27b4ab453a4340ddc3c2245 (diff)
downloadostree-36258036ae1388c728eec0237b283e225f64a7b1.tar.gz
signapi: Change API to also return a success message
This is the dual of https://github.com/ostreedev/ostree/pull/2129/commits/1f3c8c5b3de978f6e069c24938967f823cce7ee8 where we output more detail when signapi fails to validate. Extend the API to return a string for success, which we output to stdout. This will help the test suite *and* end users validate that the expected thing is happening. In order to make this cleaner, split the "verified commit" set in the pull code into GPG and signapi verified sets, and have the signapi verified set contain the verification string. We're not doing anything with the verification string in the pull code *yet* but I plan to add something like `ostree pull --verbose` which would finally print this.
Diffstat (limited to 'src/ostree')
-rw-r--r--src/ostree/ot-builtin-sign.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ostree/ot-builtin-sign.c b/src/ostree/ot-builtin-sign.c
index d6cc167a..c7777489 100644
--- a/src/ostree/ot-builtin-sign.c
+++ b/src/ostree/ot-builtin-sign.c
@@ -70,6 +70,7 @@ ostree_builtin_sign (int argc, char **argv, OstreeCommandInvocation *invocation,
g_autoptr (OstreeRepo) repo = NULL;
g_autoptr (OstreeSign) sign = NULL;
g_autofree char *resolved_commit = NULL;
+ g_autofree char *success_message = NULL;
const char *commit;
char **key_ids;
int n_key_ids, ii;
@@ -130,9 +131,12 @@ ostree_builtin_sign (int argc, char **argv, OstreeCommandInvocation *invocation,
if (ostree_sign_commit_verify (sign,
repo,
resolved_commit,
+ &success_message,
cancellable,
&local_error))
{
+ g_assert (success_message);
+ g_print ("%s\n", success_message);
ret = TRUE;
goto out;
}
@@ -180,9 +184,13 @@ ostree_builtin_sign (int argc, char **argv, OstreeCommandInvocation *invocation,
if (ostree_sign_commit_verify (sign,
repo,
resolved_commit,
+ &success_message,
cancellable,
error))
- ret = TRUE;
+ {
+ g_print ("%s\n", success_message);
+ ret = TRUE;
+ }
} /* Check via file */
}
else