// Assuming `etcd_health` is the variable holding the output
var etcd_health = state.etcd_health; // Retrieve `etcd_health` from the state
// Check if etcd_health is defined and is a string
if (etcd_health && typeof etcd_health === 'string') {
// Check if the string contains "healthy"
var status = "unhealthy"; // Default status
if (etcd_health.includes("healthy")) {
status = "healthy";
}
// Save the status in the state for later use
state.etcd_status = status;
// You can store a debug message for later viewing
state.debug_message = "ETCD Health Status: " + status;
} else {
// Handle the case where `etcd_health` is undefined or not a string
state.etcd_status = "unknown"; // Default status for error cases
state.debug_message = "Error: 'etcd_health' is undefined or not a string.";
}





0 comments:
Post a Comment