[ostree] ostree/remote-add: Add --no-gpg-verify option



commit 39e3c1bb8a5e790a8e7824d4fb3fc986c65b994e
Author: Colin Walters <walters verbum org>
Date:   Wed Dec 25 14:17:36 2013 -0500

    ostree/remote-add: Add --no-gpg-verify option
    
    To more conveniently disable GPG verification.

 src/ostree/ot-builtin-remote.c |    6 ++++++
 tests/test-remote-add.sh       |    6 +++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/ostree/ot-builtin-remote.c b/src/ostree/ot-builtin-remote.c
index 495b27e..7db9edc 100644
--- a/src/ostree/ot-builtin-remote.c
+++ b/src/ostree/ot-builtin-remote.c
@@ -27,9 +27,11 @@
 #include "otutil.h"
 
 char **opt_set;
+gboolean opt_no_gpg_verify;
 
 static GOptionEntry options[] = {
   { "set", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_set, "Set config option KEY=VALUE for remote", "KEY=VALUE" 
},
+  { "no-gpg-verify", 0, 0, G_OPTION_ARG_NONE, &opt_no_gpg_verify, "Disable GPG verification", NULL },
   { NULL }
 };
 
@@ -124,6 +126,10 @@ ostree_builtin_remote (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
         g_key_file_set_string_list (config, key, "branches",
                                     (const char *const *)branches->pdata,
                                     branches->len);
+
+      if (opt_no_gpg_verify)
+        g_key_file_set_boolean (config, key, "gpg-verify", FALSE);
+
       g_free (key);
     }
   else if (!strcmp (op, "show-url"))
diff --git a/tests/test-remote-add.sh b/tests/test-remote-add.sh
index 252090b..7cd8812 100755
--- a/tests/test-remote-add.sh
+++ b/tests/test-remote-add.sh
@@ -21,10 +21,14 @@ set -e
 
 . $(dirname $0)/libtest.sh
 
-echo '1..2'
+echo '1..3'
 
 setup_test_repository "bare"
 $OSTREE remote add origin http://example.com/ostree/gnome
 echo "ok remote add"
 assert_file_has_content $test_tmpdir/repo/config "example.com"
 echo "ok config"
+
+$OSTREE remote add --no-gpg-verify another http://another.com/repo
+assert_file_has_content $test_tmpdir/repo/config "gpg-verify=false"
+echo "ok remote no gpg-verify"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]