check for SERVICE_DIR in __virtual__ in salt.modules.daemontools (#37748)

* set __virtualname__ to 'service'

* add SERVICE_DIR check in __virtual__
This commit is contained in:
Julien Cigar 2016-11-17 18:20:43 +01:00 committed by Nicole Thomas
parent fa7883115e
commit 6ba8d4e97f

View file

@ -48,7 +48,9 @@ for service_dir in VALID_SERVICE_DIRS:
def __virtual__():
# Ensure that daemontools is installed properly.
BINS = frozenset(('svc', 'supervise', 'svok'))
return __virtualname__ if all(salt.utils.which(b) for b in BINS) else False
if all(salt.utils.which(b) for b in BINS) and SERVICE_DIR:
return __virtualname__
return False
def _service_path(name):