Skip to content

Commit b6cdfa4

Browse files
committed
updates for eli 0.35.0
1 parent cd6b6b8 commit b6cdfa4

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/ami-plugin/asctl.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ function asctl.exec(...)
1515
if not proc then
1616
error("Failed to execute asctl command: " .. cmd)
1717
end
18-
trace("asctl exit code: " .. proc.exitcode)
18+
trace("asctl exit code: " .. proc.exit_code)
1919

2020
local stderr = proc.stderrStream:read("a")
2121
local stdout = proc.stdoutStream:read("a")
22-
return proc.exitcode, stdout, stderr
22+
return proc.exit_code, stdout, stderr
2323
end
2424

2525
function asctl.with_options(options)
@@ -46,24 +46,24 @@ function asctl.install_service(sourceFile, serviceName, options)
4646
}))
4747

4848
if type(options.reload) ~= "boolean" or options.reload == true then
49-
local _exitcode, _stdout, _stderr = asctl.exec("reload")
50-
if _exitcode ~= 0 then
49+
local _exit_code, _stdout, _stderr = asctl.exec("reload")
50+
if _exit_code ~= 0 then
5151
warn({ msg = "Failed to reload ascend daemon!", stdout = _stdout, stderr = _stderr })
5252
end
5353
end
5454
end
5555

5656
function asctl.start_service(serviceName)
5757
trace("Starting service: ${service}", { service = serviceName })
58-
local exitcode = asctl.exec("start", serviceName)
59-
assert(exitcode == 0, "Failed to start service")
58+
local exit_code = asctl.exec("start", serviceName)
59+
assert(exit_code == 0, "Failed to start service")
6060
trace("Service ${service} started.", { service = serviceName })
6161
end
6262

6363
function asctl.stop_service(serviceName)
6464
trace("Stoping service: ${service}", { service = serviceName })
65-
local exitcode = asctl.exec("stop", serviceName)
66-
assert(exitcode == 0, "Failed to stop service")
65+
local exit_code = asctl.exec("stop", serviceName)
66+
assert(exit_code == 0, "Failed to stop service")
6767
trace("Service ${service} stopped.", { service = serviceName })
6868
end
6969

@@ -78,8 +78,8 @@ function asctl.remove_service(serviceName, options)
7878
if not fs.exists(serviceUnitFile) then return end -- service not found so skip
7979

8080
trace("Removing service: ${service}", { service = serviceName })
81-
local exitcode = asctl.exec("stop", serviceName)
82-
assert(exitcode == 0, "Failed to stop service")
81+
local exit_code = asctl.exec("stop", serviceName)
82+
assert(exit_code == 0, "Failed to stop service")
8383
trace("Service ${service} stopped.", { service = serviceName })
8484

8585
trace("Removing service...")
@@ -93,8 +93,8 @@ function asctl.remove_service(serviceName, options)
9393
end
9494

9595
if type(options.reload) ~= "boolean" or options.reload == true then
96-
local exitcode, stdout, stderr = asctl.exec("reload")
97-
if exitcode ~= 0 then
96+
local exit_code, stdout, stderr = asctl.exec("reload")
97+
if exit_code ~= 0 then
9898
warn({ msg = "Failed to reload ascend!", stdout = stdout, stderr = stderr })
9999
end
100100
end
@@ -103,8 +103,8 @@ end
103103

104104
function asctl.get_service_status(serviceName)
105105
trace("Getting service " .. serviceName .. "status...")
106-
local exitcode, stdout = asctl.exec("status", serviceName)
107-
assert(exitcode == 0, "Failed to get service status")
106+
local exit_code, stdout = asctl.exec("status", serviceName)
107+
assert(exit_code == 0, "Failed to get service status")
108108
local response = hjson.parse(stdout) --[[@as table<string, { ok: boolean, status: table<string, AscendManagedServiceModuleStatus> }>]]
109109
local serviceStatus = response[serviceName].status
110110
local moduleStatus = serviceStatus.default

src/ascend/services.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,15 +675,15 @@ local function run_healthcheck(serviceName, moduleName, health, healthcheckDefin
675675
break
676676
end
677677

678-
local exitcode = proc --[[@as EliProcess]]:wait(1, 1000)
679-
if exitcode < 0 then -- in progress
678+
local exit_code = proc --[[@as EliProcess]]:wait(1, 1000)
679+
if exit_code < 0 then -- in progress
680680
coroutine.yield()
681681
goto CONTINUE
682-
elseif exitcode == 0 then
682+
elseif exit_code == 0 then
683683
health.state = "healthy"
684684
elseif health.unhealthyCheckCount + 1 >= healthcheckDefinition.retries then
685685
log_info("healthcheck for ${service}:${module} failed with exit code ${code}",
686-
{ service = serviceName, module = moduleName, code = exitcode })
686+
{ service = serviceName, module = moduleName, code = exit_code })
687687
health.state = "unhealthy"
688688
else
689689
health.unhealthyCheckCount = health.unhealthyCheckCount + 1

tests/healtchecks.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test["health checks - timeout"] = function()
133133
break
134134
end
135135
if os.time() > startTime + 10 then
136-
return false, "Service did not timeout in time"
136+
return false, "Service did not timeout in time: " .. tostring(os.time() - startTime) .. "s"
137137
end
138138
end
139139

0 commit comments

Comments
 (0)