We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc4be52 commit ce3550fCopy full SHA for ce3550f
1 file changed
utils/src/com/cloud/utils/ssh/SSHCmdHelper.java
@@ -155,8 +155,15 @@ public static int sshExecuteCmdOneShotWithExitCode(com.trilead.ssh2.Connection s
155
String result = sbResult.toString();
156
if (result != null && !result.isEmpty())
157
s_logger.debug(cmd + " output:" + result);
158
-
159
- return sshSession.getExitStatus();
+ // exit status delivery might get delayed
+ for(int i = 0 ; i<10 ; i++ ) {
160
+ Integer status = sshSession.getExitStatus();
161
+ if( status != null ) {
162
+ return status;
163
+ }
164
+ Thread.sleep(100);
165
166
+ return -1;
167
} catch (Exception e) {
168
s_logger.debug("Ssh executed failed", e);
169
throw new SshException("Ssh executed failed " + e.getMessage());
0 commit comments