Filippo Giunchedi has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/190227

Change subject: wmf-reimage: ask for ipmi password if possible
......................................................................

wmf-reimage: ask for ipmi password if possible

aka "don't troll the user"

also just pass in IPMI_PASSWORD, don't export

Change-Id: Ib5e2350112bc0b6d850f7593e1a693df025fd435
---
M modules/puppetmaster/files/wmf-reimage
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/27/190227/1

diff --git a/modules/puppetmaster/files/wmf-reimage 
b/modules/puppetmaster/files/wmf-reimage
index 29149c1..e45c982 100755
--- a/modules/puppetmaster/files/wmf-reimage
+++ b/modules/puppetmaster/files/wmf-reimage
@@ -102,15 +102,19 @@
 function set_pxe_and_reboot {
     mgmtname=${1}
     if [ -z "$IPMI_PASSWORD" ]; then
-           echo "WARNING: IPMI_PASSWORD not found. Assuming bash, do: "
-           echo "HISTCONTROL=ignoreboth<enter>"
-           echo "<space>export IPMI_PASSWORD='supersecretpass'"
-           echo "WARNING: Continuing without auto rebooting the box"
-           return
+        echo "WARNING: IPMI_PASSWORD not found."
+        if ! tty -s; then
+            echo "Assuming bash, do: "
+            echo "HISTCONTROL=ignoreboth<enter>"
+            echo "<space>export IPMI_PASSWORD='supersecretpass'"
+            echo "WARNING: Continuing without auto rebooting the box"
+            return
+        fi
+        read -s -p "IPMI password: "
+        IPMI_PASSWORD=$REPLY
     fi
-    export IPMI_PASSWORD
-    ipmitool -I lanplus -H ${mgmtname} -U root -E chassis bootdev pxe
-    ipmitool -I lanplus -H ${mgmtname} -U root -E chassis power cycle
+    IPMI_PASSWORD=$IPMI_PASSWORD ipmitool -I lanplus -H ${mgmtname} -U root -E 
chassis bootdev pxe
+    IPMI_PASSWORD=$IPMI_PASSWORD ipmitool -I lanplus -H ${mgmtname} -U root -E 
chassis power cycle
 }
 
 function enable_and_run_puppet {

-- 
To view, visit https://gerrit.wikimedia.org/r/190227
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5e2350112bc0b6d850f7593e1a693df025fd435
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to