mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 13:03:02 +02:00
confd: augment new services container to ietf-system
This patch adds operational data support for system services. The
data is in a generic format but is intended to be able to represent
finit information (initctl) nicely.
The reason for augmenting this to ietf-system and not to
infix-services is that we consider this generic system information
which is totally disconnected from what ever services infix might
provide.
In this first state we only support pid, name, description and state.
Making the data look something like:
"infix-system:services": {
"service": [
{
"pid": 1185,
"name": "udevd",
"status": "running",
"description": "Device event daemon (udev)"
}]
Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
@@ -177,6 +177,24 @@ def add_platform(out):
|
||||
|
||||
insert(out, "platform", platform)
|
||||
|
||||
def add_services(out):
|
||||
data = HOST.run_json(["initctl", "-j"], [])
|
||||
services = []
|
||||
|
||||
for d in data:
|
||||
if "pid" not in d or "status" not in d or "identity" not in d or "description" not in d:
|
||||
continue
|
||||
|
||||
entry = {
|
||||
"pid": d["pid"],
|
||||
"name": d["identity"],
|
||||
"status": d["status"],
|
||||
"description": d["description"]
|
||||
}
|
||||
services.append(entry)
|
||||
|
||||
insert(out, "infix-system:services", "service", services)
|
||||
|
||||
def add_software(out):
|
||||
software = {}
|
||||
try:
|
||||
@@ -291,5 +309,6 @@ def operational():
|
||||
add_dns(out_state)
|
||||
add_clock(out_state)
|
||||
add_platform(out_state)
|
||||
add_services(out_state)
|
||||
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user