Author: arkurth
Date: Tue Jun 23 14:15:16 2009
New Revision: 787686

URL: http://svn.apache.org/viewvc?rev=787686&view=rev
Log:
VCL-167
utils.pm::run_ssh_command() was not catching SSH "host key differs" warning 
messages. Added code to filter these messages from the output that is returned 
to the caller. The SSH command was succeeding when this warning was displayed 
but callers were failing because of the unexpected output.

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=787686&r1=787685&r2=787686&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Tue Jun 23 14:15:16 2009
@@ -6666,9 +6666,15 @@
                # Strip out the key warning message from the output
                $ssh_output =~ s/\...@{10,}.*man-in-the-middle attacks\.//igs;
                
-               # Strip out known hosts warning message
+               # Strip out known SSH warning messages
                #    Warning: Permanently added 'blade1b2-8' (RSA) to the list 
of known hosts.
-               $ssh_output =~ s/Warning: Permanently added .+ to the list of 
known hosts\.//igs;
+               # 
+               #    Warning: the RSA host key for 'vi1-62' differs from the 
key for the IP address '10.25.7.62'
+               #    Offending key for IP in /root/.ssh/known_hosts:264
+               #    Matching host key in /root/.ssh/known_hosts:3977
+               $ssh_output =~ s/^Warning:.*//ig;
+               $ssh_output =~ s/^Offending key.*//ig;
+               $ssh_output =~ s/^Matching host key in.*//ig;
                
                # Remove any spaces from the beginning and end of the output
                $ssh_output =~ s/(^\s+)|(\s+$)//g;
@@ -10433,7 +10439,7 @@
                }
        }
        
-       return $ascii_value_string;
+       return $ascii_value_string || '';
 }
 
 #/////////////////////////////////////////////////////////////////////////////


Reply via email to