Skip to content

Commit

Permalink
Take in account new usages of removed libs after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Feb 8, 2024
1 parent 57c052d commit 83b0eee
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import java.io.IOException;
import java.io.File;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -66,8 +66,8 @@ public class DockerComposeRuntime implements ContainerOrchestrationRuntime {

private final List<ContainerOrchestrationRuntimeExtension> extensions;

private final List<String> dockerComposeCommand;
private final List<String> dockerComposeCommand;

private static final boolean IS_OS_WINDOWS = isWindows();

private static final boolean IS_OS_MAC = isMac();
Expand Down Expand Up @@ -127,7 +127,7 @@ private static List<ContainerOrchestrationRuntimeExtension> getDefaultRuntimeExt
}

public DockerComposeRuntime(Carnotzet carnotzet, String instanceId, CommandRunner commandRunner, Boolean shouldExposePorts,
List<ContainerOrchestrationRuntimeExtension> extensions) {
List<ContainerOrchestrationRuntimeExtension> extensions) {
this.carnotzet = carnotzet;
if (instanceId != null) {
this.instanceId = instanceId;
Expand Down Expand Up @@ -281,7 +281,7 @@ private void invokeAllExtensions(BiFunction<ContainerOrchestrationRuntimeExtensi
}

private void invokeAllExtensions(BiFunction<ContainerOrchestrationRuntimeExtension, CarnotzetModule, CarnotzetModule> consumer,
CarnotzetModule module) {
CarnotzetModule module) {
CarnotzetModule modified = module;
for (ContainerOrchestrationRuntimeExtension extension : extensions) {
modified = consumer.apply(extension, modified);
Expand Down Expand Up @@ -391,7 +391,7 @@ private String findExternalNetworkName() {
String buildContainerId =
runCommandAndCaptureOutput("/bin/sh", "-c", "docker ps | grep $(hostname) | grep -v k8s_POD | cut -d ' ' -f 1");

if (Strings.isNullOrEmpty(buildContainerId)) {
if (buildContainerId == null || buildContainerId.trim().isEmpty()) {
// we are probably not running inside a container, return default external network name
return carnotzet.getExternalNetworkName();
}
Expand All @@ -404,7 +404,7 @@ private String findExternalNetworkName() {
log.debug("Running inside a container with network name [{}]", networkName);

// return default external network name if cannot find the current external network name
return StringUtils.isBlank(networkName) ? carnotzet.getExternalNetworkName() : networkName;
return networkName.trim().isEmpty() ? carnotzet.getExternalNetworkName() : networkName;
}

private String getDockerNetworkName() {
Expand Down

0 comments on commit 83b0eee

Please sign in to comment.