add debugging to monkeysphere-host publish-key, closes: #2289
authorMicah Anderson <micah@riseup.net>
Sat, 2 Oct 2010 19:06:16 +0000 (15:06 -0400)
committerMicah Anderson <micah@riseup.net>
Sat, 2 Oct 2010 20:12:52 +0000 (16:12 -0400)
src/monkeysphere-host
src/share/mh/publish_key

index 33a67ccc39b88c36f381ea7a596cd0f1d6f63bf2..17f918cfe368f384489b8600d8030aa696f9466c 100755 (executable)
@@ -257,16 +257,22 @@ multi_key() {
 
     check_no_keys
 
+    log debug "listing primary fingerprints from $HOST_KEY_FILE"
     local fprs=($(list_primary_fingerprints <"$HOST_KEY_FILE"))
+    log debug "obtained the following fingerprints: $fprs"
 
     if [[ -z "$1" || "$1" == '--all' ]] ; then
+       log debug "publishing all keys"
        keys="${fprs[@]}"
     fi
 
+    log debug "using keys: $keys"
+
     for key in $keys ; do
        if (( i++ > 0 )) ; then
            printf "\n"
        fi
+       log debug "invoking $cmd $key"
        "$cmd" "$key"
     done
 }
@@ -338,6 +344,7 @@ show_key() {
 # defaults
 LOG_LEVEL=${MONKEYSPHERE_LOG_LEVEL:=$LOG_LEVEL}
 KEYSERVER=${MONKEYSPHERE_KEYSERVER:=$KEYSERVER}
+log debug "using keyserver: $KEYSERVER"
 CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=$CHECK_KEYSERVER}
 MONKEYSPHERE_USER=${MONKEYSPHERE_MONKEYSPHERE_USER:=$MONKEYSPHERE_USER}
 MONKEYSPHERE_GROUP=$(get_primary_group "$MONKEYSPHERE_USER")
index 52c8b8685384d6d826832673603c629799c81338..c8da8471ffc747f17d996705f6b5e66d81c6496b 100644 (file)
@@ -19,6 +19,7 @@ local keyID="$1"
 local GNUPGHOME
 
 if [ "$PROMPT" != "false" ] ; then
+    log debug "Because \$MONKEYSPHERE_PROMPT is set to $PROMPT, interactively confirm publishing key"
     printf "Really publish key '$keyID' to $KEYSERVER? (Y/n) " >&2
     read OK; OK=${OK:=Y}
     if [ "${OK/y/Y}" != 'Y' ] ; then
@@ -44,11 +45,13 @@ su_monkeysphere_user \
 KEYSERVER_OPTIONS=""
 for anchorfile in "${SYSCONFIGDIR}/monkeysphere-host-x509-anchors.crt" "${SYSCONFIGDIR}/monkeysphere-x509-anchors.crt"; do
     if [ -z "$KEYSERVER_OPTIONS" ] && [ -r "$anchorfile"  ] ; then
+       log debug "using trust anchor file: $anchorfile"
         KEYSERVER_OPTIONS="--keyserver-options 'ca-cert-file=$anchorfile'"
     fi
 done
 
 # publish key
+log debug "publishing key with the following gpg command line and options:"
 su_monkeysphere_user \
     "gpg --keyserver $KEYSERVER $KEYSERVER_OPTIONS --send-keys '0x${keyID}!'"