Merge "Fix Python version for Travis CI tests"
diff --git a/_modules/dockerng_service.py b/_modules/dockerng_service.py
index 081b7e0..2a6b20e 100644
--- a/_modules/dockerng_service.py
+++ b/_modules/dockerng_service.py
@@ -22,6 +22,10 @@
__opts__ = {}
__virtualname__ = 'dockerng_service'
+salt_version = __salt__['grains.get']('saltversioninfo', default=[2017,7,6])
+docker_module = 'docker'
+if salt_version < [2017,7]:
+ docker_module = 'dockerng'
def __virtual__():
@@ -35,7 +39,7 @@
def status(container, service):
cmd = "systemctl show " + service + " -p ActiveState,SubState,UnitFileState"
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
data = data.splitlines()
result = dict(s.split('=') for s in data)
return result
@@ -43,7 +47,7 @@
def status_retcode(container, service):
cmd = "systemctl show " + service + " -p ActiveState,SubState,UnitFileState"
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
data = data.splitlines()
result = dict(s.split('=') for s in data)
if result['ActiveState'] == "active" and result['SubState'] == "running":
@@ -53,7 +57,7 @@
def restart(container, service):
cmd = "systemctl restart " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True
@@ -61,7 +65,7 @@
def stop(container, service):
cmd = "systemctl stop " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True
@@ -69,7 +73,7 @@
def start(container, service):
cmd = "systemctl start " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True
@@ -77,7 +81,7 @@
def enable(container, service):
cmd = "systemctl enable " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True
@@ -85,7 +89,7 @@
def reload(container, service):
cmd = "systemctl reload " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True
@@ -93,7 +97,7 @@
def disable(container, service):
cmd = "systemctl disable " + service
- data = __salt__['dockerng.run'](container, cmd)
+ data = __salt__[docker_module + '.run'](container, cmd)
if len(data) > 0:
return False
return True