The
VMware Photon OS is the operating system of the runtime environment (RTE) containers of VCF Automation. This post shows approaches how to detect the OS version of the different RTEs.
Get Photon OS Version
Three approaches, in Python, JavaScript for Node and PowerShell, and the output in release 8.18.0 are presented below, to detect OS details.
VMware Photon OS 4 is returned in all cases.
Python
import json
import subprocess
def handler(context, inputs):
result = subprocess.run(
["cat", "/etc/os-release"],
capture_output = True,
text = True
)
outputs = {
"status": "done",
"result": result.stdout
}
return outputs
|
Node
exports.handler = (context, inputs, callback) => {
var result = require("child_process").execSync(
"cat /etc/os-release"
);
callback(
undefined,
{
status: "done",
result: result.toString()
}
);
}
|
PowerShell
function Handler($context, $inputs) {
$result = & "cat" @("/etc/os-release") | Out-String
$output=@{
status = "done"
result = $result
}
return $output
}
|
Result of VCF Automation 8.18.0
NAME="VMware Photon OS"
VERSION="4.0"
ID=photon
VERSION_ID=4.0
PRETTY_NAME="VMware Photon OS/Linux"
ANSI_COLOR="1;34"
HOME_URL="https://vmware.github.io/photon/"
BUG_REPORT_URL="https://github.com/vmware/photon/issues"
|