mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
The health and action fixtures carried sample object names from the upstream project; renamed in step with every assertion that reads them.
32 lines
1.1 KiB
Lua
32 lines
1.1 KiB
Lua
local hs = {}
|
|
|
|
if obj.status ~= nil and (obj.status.health ~= nil or obj.status.expectedNodes ~= nil) then
|
|
if obj.status.health == "red" then
|
|
hs.status = "Degraded"
|
|
hs.message = "Elastic Beat status is Red"
|
|
return hs
|
|
elseif obj.status.health == "green" then
|
|
hs.status = "Healthy"
|
|
hs.message = "Elastic Beat status is Green"
|
|
return hs
|
|
elseif obj.status.health == "yellow" then
|
|
if obj.status.availableNodes ~= nil and obj.status.expectedNodes ~= nil then
|
|
hs.status = "Progressing"
|
|
hs.message = "Elastic Beat status is deploying, there is " .. obj.status.availableNodes .. " instance(s) on " .. obj.status.expectedNodes .. " expected"
|
|
return hs
|
|
else
|
|
hs.status = "Progressing"
|
|
hs.message = "Elastic Beat phase is progressing"
|
|
return hs
|
|
end
|
|
elseif obj.status.health == nil then
|
|
hs.status = "Progressing"
|
|
hs.message = "Elastic Beat phase is progressing"
|
|
return hs
|
|
end
|
|
end
|
|
|
|
hs.status = "Unknown"
|
|
hs.message = "Elastic Beat status is unknown. Ensure your Hanzo CD is current and then check for/file a bug report: https://github.com/hanzocd/cd/issues"
|
|
return hs
|