Changed to using ssh to log os console.
- Created ssh_pw program.
- Modified "Stop OS Console Logging" and "Start OS Console Logging" to
work with new ssh_pw program.
- Created 2 supporting keywords:
- "Create OS Console File Path"
- "Create OS Console Command String"
- Removed "Stop OBMC Console Client" keyword which is no longer needed.
- Modified tox.ini to be able to find ssh_pw.
Change-Id: Ifd8fc95db16fcbcbbe0a36d7e4d09383e2d1e161
Signed-off-by: David Shaw <dlshaw@us.ibm.com>
diff --git a/bin/ssh_pw b/bin/ssh_pw
new file mode 100755
index 0000000..daf558c
--- /dev/null
+++ b/bin/ssh_pw
@@ -0,0 +1,71 @@
+#!/usr/bin/expect --
+
+# ssh using the parms provided by the caller. The benefit provided by this
+# program is that it will enter the password for you (i.e. non-interactively).
+
+# Description of arguments:
+# Arg0: The password.
+# Arg1: The ssh parm string. This is the totality of ssh parms you wish to
+# specify (e.g. userid, host, etc.).
+
+
+###############################################################################
+# Main
+
+ # Get arguments.
+ set password [lindex $argv 0]
+ set ssh_parms [lreplace $argv 0 0]
+
+ eval spawn ssh ${ssh_parms}
+
+ set timeout 30
+
+ set max_attempts 3
+
+ set attempts 0
+ while { 1 } {
+ incr attempts 1
+ expect {
+ -re "assword:" {
+ send "$password\r"
+ break
+ }
+ -re "Are you sure you want to continue connecting" {
+ if { $attempts > $max_attempts } {
+ puts stderr "**ERROR** Exceeded $max_attempts attempts to ssh."
+ exit 1
+ }
+ send "yes\r"
+ }
+ timeout {
+ puts stderr "**ERROR** Timed out waiting for password prompt."
+ exit 1
+ }
+ eof {
+ puts stderr "**ERROR** End of data waiting for password prompt."
+ exit 1
+ }
+ }
+ }
+
+ set timeout 3
+ expect {
+ "Permission denied, please try again." {
+ puts ""
+ puts "**ERROR** Incorrect userid or password provided to this program."
+ exit 1
+ }
+ }
+
+ set timeout -1
+
+ # We don't ever expect to see this string. This will keep this program
+ # running indefinitely.
+ expect {
+ "When in the course of human events, it becomes :" {send "whatever\r"}
+ }
+
+ exit 0
+
+###############################################################################
+