Nebula: add VM connection timeout
This commit is contained in:
parent
78c8a9e74e
commit
ec523ddfb4
|
@ -149,6 +149,7 @@ def runInNewVM(Map args, Closure body) {
|
|||
def vmTemplate = args.get('vmTemplate', '')
|
||||
def terminateOnExit = args.get('terminateOnExit', true)
|
||||
def shell = args.get("shell", "/bin/sh")
|
||||
def connectionTimeout = args.get('connectionTimeout', 10)
|
||||
|
||||
// On récupère les identifiants de connexion SSH pour la VM
|
||||
withCredentials([
|
||||
|
@ -161,12 +162,14 @@ def runInNewVM(Map args, Closure body) {
|
|||
|
||||
// On attend que la connexion SSH soit disponible
|
||||
println "En attente de l'accès SSH sur la machine ${host}..."
|
||||
while(true) {
|
||||
def status = sh script: "nc -zv ${host} 22", returnStatus: true
|
||||
if (status == 0) {
|
||||
break;
|
||||
timeout(connectionTimeout) {
|
||||
while(true) {
|
||||
def status = sh script: "nc -zv ${host} 22", returnStatus: true
|
||||
if (status == 0) {
|
||||
break;
|
||||
}
|
||||
sleep(5)
|
||||
}
|
||||
sleep(5)
|
||||
}
|
||||
|
||||
def remoteShell = { script ->
|
||||
|
|
Loading…
Reference in New Issue