Skip to content

Commit

Permalink
Merge branch 'inspect-architecture' into 'main'
Browse files Browse the repository at this point in the history
Add architecture to image inspect output

See merge request weblogic-cloud/weblogic-image-tool!487
  • Loading branch information
ddsharpe committed Oct 7, 2024
2 parents be430fb + fe6df03 commit adc8a6f
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public String toString() {
result.append(pad(1)).append('\"').append("os").append('\"').append(" : {\n");
result.append(jsonKeyValuePair(2, "id", os.id())).append(",\n");
result.append(jsonKeyValuePair(2, "name", os.name())).append(",\n");
result.append(jsonKeyValuePair(2, "version", os.version()));
result.append(jsonKeyValuePair(2, "version", os.version())).append(",\n");
result.append(jsonKeyValuePair(2, "architecture", os.architecture()));
if (os.releasePackage() != null) {
result.append(",\n");
result.append(jsonKeyValuePair(2, "releasePackage", os.releasePackage())).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class OperatingSystemProperties {
private String version;
private String name;
private String releasePackage;
private String architecture;

public String id() {
return id;
Expand All @@ -29,6 +30,10 @@ public String releasePackage() {
return releasePackage;
}

public String architecture() {
return architecture;
}

/**
* Using the properties obtained from the image, extract the OS properties prefixed with __OS__.
* @param imageProperties properties returned from the image inspection
Expand All @@ -43,6 +48,7 @@ public static OperatingSystemProperties getOperatingSystemProperties(Properties
}
result.name = removeQuotes(imageProperties.getProperty("__OS__NAME"));
result.releasePackage = removeQuotes(imageProperties.getProperty("__OS__RELEASE_PACKAGE"));
result.architecture = imageProperties.getProperty("__OS__arch");
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ if [ -n "$ORACLE_HOME" ]; then
echo oracleInstalledProducts="$(awk -F\" '{ORS=","} /product-family/ { print $2 }' "$ORACLE_HOME"/inventory/registry.xml | sed 's/,$//')"
fi

echo __OS__arch="$(uname -m)"
if [ -f "/etc/os-release" ]; then
grep '=' /etc/os-release | sed 's/^/__OS__/'
releasePackage="$(type rpm >/dev/null 2>&1 && rpm -qf /etc/os-release || echo '')"
Expand Down
1 change: 1 addition & 0 deletions imagetool/src/main/resources/probe-env/inspect-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ if [ -n "$ORACLE_HOME" ]; then
echo oracleInstalledProducts="$(awk -F\" '{ORS=","} /product-family/ { print $2 }' "$ORACLE_HOME"/inventory/registry.xml | sed 's/,$//')"
fi

echo __OS__arch="$(uname -m)"
if [ -f "/etc/os-release" ]; then
grep '=' /etc/os-release | sed 's/^/__OS__/'
releasePackage="$(type rpm >/dev/null 2>&1 && rpm -qf /etc/os-release || echo '')"
Expand Down
3 changes: 2 additions & 1 deletion imagetool/src/test/resources/inspect/image1.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"os" : {
"id" : "ol",
"name" : "Oracle Linux Server",
"version" : "7.9"
"version" : "7.9",
"architecture" : "x86_64"
},
"javaHome" : "/u01/jdk",
"javaVersion" : "1.8.0_202",
Expand Down
3 changes: 2 additions & 1 deletion imagetool/src/test/resources/inspect/image1.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ wlsVersion=12.2.1.3.0
javaHome=/u01/jdk
__OS__NAME="Oracle Linux Server"
__OS__VERSION="7.9"
__OS__ID="ol"
__OS__ID="ol"
__OS__arch=x86_64
3 changes: 2 additions & 1 deletion imagetool/src/test/resources/inspect/image2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"os" : {
"id" : "ol",
"name" : "Oracle Linux Server",
"version" : "7.9"
"version" : "7.9",
"architecture" : "x86_64"
},
"domainHome" : "/u01/domains/base_domain",
"javaHome" : "/u01/jdk",
Expand Down
3 changes: 2 additions & 1 deletion imagetool/src/test/resources/inspect/image2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ wlsVersion=12.2.1.4.0
javaHome=/u01/jdk
__OS__NAME="Oracle Linux Server"
__OS__VERSION="7.9"
__OS__ID="ol"
__OS__ID="ol"
__OS__arch=x86_64
1 change: 1 addition & 0 deletions imagetool/src/test/resources/inspect/image3.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"id" : "ol",
"name" : "Oracle Linux Server",
"version" : "7.9",
"architecture" : "x86_64",
"releasePackage" : "oraclelinux-release-7.9-1.0.7.el8.x86_64"
},
"domainHome" : "/u01/domains/base_domain",
Expand Down
1 change: 1 addition & 0 deletions imagetool/src/test/resources/inspect/image3.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ __OS__NAME="Oracle Linux Server"
__OS__VERSION="7.9"
__OS__ID="ol"
__OS__RELEASE_PACKAGE="oraclelinux-release-7.9-1.0.7.el8.x86_64"
__OS__arch=x86_64

0 comments on commit adc8a6f

Please sign in to comment.