From c8a196b6bb48760172f5548c0bd00eea51b4a088 Mon Sep 17 00:00:00 2001 From: Bryan Chow Date: Tue, 30 Jul 2013 00:18:56 -0700 Subject: [PATCH] Prevent inadvertent CommandExecutionError on daemontools module import --- salt/modules/daemontools.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/salt/modules/daemontools.py b/salt/modules/daemontools.py index 58e52e6352..a33f7fad51 100644 --- a/salt/modules/daemontools.py +++ b/salt/modules/daemontools.py @@ -29,14 +29,14 @@ for service_dir in VALID_SERVICE_DIRS: if os.path.exists(service_dir): SERVICE_DIR = service_dir break -if not SERVICE_DIR: - raise CommandExecutionError("Could not find service directory.") def _service_path(name): ''' build service path ''' + if not SERVICE_DIR: + raise CommandExecutionError("Could not find service directory.") return '{0}/{1}'.format(SERVICE_DIR, name) @@ -146,5 +146,7 @@ def get_all(): salt '*' daemontools.get_all ''' + if not SERVICE_DIR: + raise CommandExecutionError("Could not find service directory.") #- List all daemontools services in return sorted(os.listdir(SERVICE_DIR))