|
@@ -411,11 +411,11 @@ public class VultrDriver extends ComputeServiceDriverBase { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static final long SNAPSHOT_TIMEOUT = MINUTES.toMillis(60); |
|
|
public static final long SNAPSHOT_TIMEOUT = MINUTES.toMillis(60); |
|
|
@Override public List<PackerImage> finalizeIncompletePackerRun(CommandResult commandResult, String jarSha) { |
|
|
|
|
|
|
|
|
@Override public List<PackerImage> finalizeIncompletePackerRun(CommandResult commandResult, AnsibleInstallType installType, String jarSha) { |
|
|
if (!commandResult.getStdout().contains("Waiting 300s for snapshot") |
|
|
if (!commandResult.getStdout().contains("Waiting 300s for snapshot") |
|
|
|| !commandResult.getStdout().contains("Error waiting for snapshot") |
|
|
|| !commandResult.getStdout().contains("Error waiting for snapshot") |
|
|
|| !commandResult.getStdout().contains("Unable to destroy server: Unable to remove VM: Server is currently locked")) { |
|
|
|| !commandResult.getStdout().contains("Unable to destroy server: Unable to remove VM: Server is currently locked")) { |
|
|
stopImageServer(jarSha); |
|
|
|
|
|
|
|
|
stopImageServer(installType, jarSha); |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -424,7 +424,7 @@ public class VultrDriver extends ComputeServiceDriverBase { |
|
|
PackerImage snapshot = null; |
|
|
PackerImage snapshot = null; |
|
|
while (now() - start < SNAPSHOT_TIMEOUT) { |
|
|
while (now() - start < SNAPSHOT_TIMEOUT) { |
|
|
snapshot = getPackerImages().stream() |
|
|
snapshot = getPackerImages().stream() |
|
|
.filter(i -> i.getName().endsWith(jarSha)) |
|
|
|
|
|
|
|
|
.filter(i -> i.getName().contains("_"+installType.name()+"_") && i.getName().endsWith(jarSha)) |
|
|
.findFirst() |
|
|
.findFirst() |
|
|
.orElse(null); |
|
|
.orElse(null); |
|
|
if (snapshot != null) break; |
|
|
if (snapshot != null) break; |
|
@@ -434,19 +434,19 @@ public class VultrDriver extends ComputeServiceDriverBase { |
|
|
log.error("finalizeIncompletePackerRun: timeout waiting for snapshot"); |
|
|
log.error("finalizeIncompletePackerRun: timeout waiting for snapshot"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!stopImageServer(jarSha)) return null; |
|
|
|
|
|
|
|
|
if (!stopImageServer(installType, jarSha)) return null; |
|
|
if (snapshot == null) return null; |
|
|
if (snapshot == null) return null; |
|
|
|
|
|
|
|
|
return new SingletonList<>(snapshot); |
|
|
return new SingletonList<>(snapshot); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public boolean stopImageServer(String jarSha) { |
|
|
|
|
|
|
|
|
public boolean stopImageServer(AnsibleInstallType installType, String jarSha) { |
|
|
// find the server |
|
|
// find the server |
|
|
final List<BubbleNode> servers; |
|
|
final List<BubbleNode> servers; |
|
|
try { |
|
|
try { |
|
|
servers = listNodes(server -> { |
|
|
servers = listNodes(server -> { |
|
|
final String tag = server.has("tag") ? server.get("tag").textValue() : null; |
|
|
final String tag = server.has("tag") ? server.get("tag").textValue() : null; |
|
|
return tag != null && tag.endsWith(jarSha); |
|
|
|
|
|
|
|
|
return tag != null && tag.contains("_"+installType.name()+"_") && tag.endsWith(jarSha); |
|
|
}); |
|
|
}); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
log.error("finalizeIncompletePackerRun: error listing servers: "+shortError(e), e); |
|
|
log.error("finalizeIncompletePackerRun: error listing servers: "+shortError(e), e); |
|
|