summaryrefslogtreecommitdiff
path: root/ncserver/module/openrc.py
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-12-07 23:25:15 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-12-07 23:25:15 -0600
commit2be0c8d53e4ef74e37441189f7aaa8374f8d0dfd (patch)
tree7620bd2c2d5620fad37f9562d84667064941e447 /ncserver/module/openrc.py
parent334cc509f08b125f9db76914efb9c7b2adfffeba (diff)
downloadnetconfapk-2be0c8d53e4ef74e37441189f7aaa8374f8d0dfd.tar.gz
netconfapk-2be0c8d53e4ef74e37441189f7aaa8374f8d0dfd.tar.bz2
netconfapk-2be0c8d53e4ef74e37441189f7aaa8374f8d0dfd.tar.xz
netconfapk-2be0c8d53e4ef74e37441189f7aaa8374f8d0dfd.zip
adelie-services: Vastly simplify YANG model
This restores the original behaviour/design. No real rationale was given for splitting into a status node other than that the server did not support returning the same node name for running and operational. It does now, so let's do this.
Diffstat (limited to 'ncserver/module/openrc.py')
-rw-r--r--ncserver/module/openrc.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/ncserver/module/openrc.py b/ncserver/module/openrc.py
index bbff980..e951af1 100644
--- a/ncserver/module/openrc.py
+++ b/ncserver/module/openrc.py
@@ -116,9 +116,8 @@ def check_alive(pidfile) -> bool:
try:
os.kill(pid, 0)
except OSError as ose:
- if ose.errno == errno.EPERM:
- return True # we can't send signal because it's alive
- return False
+ # If EPERM, we can't send the signal because it's alive.
+ return (ose.errno == errno.EPERM)
else:
return True
@@ -245,13 +244,13 @@ def running(node):
def operational(node):
"""Retrieve the service state for this device."""
- running(node) # Include the running configuration.
- svcs = util.subelm(node, 'svcs:service-status')
+ svcs = util.subelm(node, 'svcs:services')
for service in service_list():
svcnode = util.subelm(svcs, 'svcs:service')
svcnode.append(util.leaf_elm('svcs:name', service.name))
svcnode.append(util.leaf_elm('svcs:description', service.description))
+ svcnode.append(util.leaf_elm('svcs:enabled', service.enabled))
svcnode.append(util.leaf_elm(
'svcs:status', service.status().name.lower()
))