Skip to content

Commit f27d79d

Browse files
gosurya-oraclejshum2479
authored andcommitted
changes to print cache.dir ahead of cache contents, remove version default value for addInstaller
1 parent 22de6d4 commit f27d79d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/main/java/com/oracle/weblogicx/imagebuilder/cli/CLIDriver.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ public static void main(String[] args) {
5151
CommandResponse response = WLSCommandLine.call(cliDriver, true, args);
5252

5353
if (response != null) {
54-
55-
String message = String.format("Response code: %d, message: %s", response.getStatus(),
56-
response.getMessage());
5754
if (response.getStatus() != 0) {
55+
String message = String.format("Response code: %d, message: %s", response.getStatus(),
56+
response.getMessage());
5857
logger.severe(message);
59-
} else {
60-
logger.info(message);
6158
}
6259
System.exit(response.getStatus());
6360
}

src/main/java/com/oracle/weblogicx/imagebuilder/cli/cache/AddInstallerEntry.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
66
import com.oracle.weblogicx.imagebuilder.api.model.InstallerType;
77
import com.oracle.weblogicx.imagebuilder.util.Constants;
8+
import com.oracle.weblogicx.imagebuilder.util.Utils;
89
import picocli.CommandLine.Command;
910
import picocli.CommandLine.Option;
1011

@@ -29,7 +30,7 @@ public AddInstallerEntry(boolean isCLIMode) {
2930

3031
@Override
3132
public CommandResponse call() {
32-
if (location != null && Files.isRegularFile(location)) {
33+
if (location != null && Files.isRegularFile(location) && !Utils.isEmptyString(version)) {
3334
String key = String.format("%s%s%s", type, CACHE_KEY_SEPARATOR, version);
3435
cacheStore.addToCache(key, location.toAbsolutePath().toString());
3536
return new CommandResponse(0, String.format("Successfully added to cache. %s=%s", key,
@@ -49,8 +50,7 @@ public CommandResponse call() {
4950
@Option(
5051
names = {"--version"},
5152
description = "Installer version. Ex: For WLS|FMW use 12.2.1.3.0 For jdk, use 8u201",
52-
required = true,
53-
defaultValue = Constants.DEFAULT_WLS_VERSION
53+
required = true
5454
)
5555
private String version;
5656

src/main/java/com/oracle/weblogicx/imagebuilder/cli/cache/ListCacheItems.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
package com.oracle.weblogicx.imagebuilder.cli.cache;
44

55
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
6+
import com.oracle.weblogicx.imagebuilder.util.Utils;
67
import picocli.CommandLine.Command;
78

89
import java.util.Collections;
910
import java.util.Map;
1011

12+
import static com.oracle.weblogicx.imagebuilder.util.Constants.CACHE_DIR_KEY;
13+
1114
@Command(
1215
name = "listItems",
1316
description = "List cache contents"
@@ -32,9 +35,12 @@ public CommandResponse call() {
3235
} else {
3336
if (isCLIMode) {
3437
System.out.println("Cache contents");
35-
resultMap.forEach((key, value) -> {
36-
System.out.println(key + "=" + value);
37-
});
38+
String cacheDir = resultMap.getOrDefault(CACHE_DIR_KEY, null);
39+
if (!Utils.isEmptyString(cacheDir)) {
40+
System.out.println(CACHE_DIR_KEY + "=" + cacheDir);
41+
resultMap.remove(CACHE_DIR_KEY);
42+
}
43+
resultMap.forEach((key, value) -> System.out.println(key + "=" + value));
3844
}
3945
return new CommandResponse(0, "Cache contents", resultMap);
4046
}

0 commit comments

Comments
 (0)