]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
storage_deploy.sh: remove key from storage after deploy
authorThilo Fromm <thilo.fromm@profitbricks.com>
Thu, 25 Apr 2013 14:57:58 +0000 (16:57 +0200)
committerThilo Fromm <thilo.fromm@profitbricks.com>
Thu, 25 Apr 2013 14:57:58 +0000 (16:57 +0200)
Signed-off-by: Thilo Fromm <thilo.fromm@profitbricks.com>
storage_deploy.sh

index 0c1d16884ef4376fed414314c2abcaa4ad6c2acb..d4c73092da84ae2c290dc5c9cf2a29604c162e5b 100755 (executable)
@@ -18,6 +18,19 @@ prepare() {
 }
 # ----
 
+cleanup() {
+    local srv="$1"
+
+    # remove installer key from list of root authorized keys
+    rexec "$srv" "sed 's/.*\ storageautoinstaller@host/# ...key removed by auto-deploy script./' /root/.ssh/authorized_keys" \
+        || { log "    ERROR removing installer ssh key from storage server $srv."
+             log "    #######  MANUAL ATTENTION REQUIRED #######"
+             return 1}
+
+    return 0
+
+}
+# ----
 
 rexec() {
     local srv="$1" ; shift
@@ -166,6 +179,8 @@ main() {
     rexec "$storage_ip" "reboot" ||  return 1
     wait_for_reboot 600 $storage_ip || { log "    ABORT"; return 1; }
 
+    cleanup || return 1
+
     log "                     S U C C E S S"
     log "   Your storage server is now available at $storage_ip."
 }