Extend dockerng_service.running for watch method
PROD-16646
Change-Id: Ic4e270bb6b5ff927131f5e047502bba2519831c5
diff --git a/_modules/dockerng_service.py b/_modules/dockerng_service.py
index 515cc0f..081b7e0 100644
--- a/_modules/dockerng_service.py
+++ b/_modules/dockerng_service.py
@@ -41,6 +41,16 @@
return result
+def status_retcode(container, service):
+ cmd = "systemctl show " + service + " -p ActiveState,SubState,UnitFileState"
+ data = __salt__['dockerng.run'](container, cmd)
+ data = data.splitlines()
+ result = dict(s.split('=') for s in data)
+ if result['ActiveState'] == "active" and result['SubState'] == "running":
+ return True
+ return False
+
+
def restart(container, service):
cmd = "systemctl restart " + service
data = __salt__['dockerng.run'](container, cmd)
@@ -87,4 +97,3 @@
if len(data) > 0:
return False
return True
-