diff --git a/salt/utils/extmods.py b/salt/utils/extmods.py index 7466e7206066..760f6beaa072 100644 --- a/salt/utils/extmods.py +++ b/salt/utils/extmods.py @@ -8,6 +8,7 @@ import logging import os import shutil +import sys # Import salt libs import salt.fileclient @@ -131,6 +132,12 @@ def sync(opts, shutil.copyfile(fn_, dest) ret.append('{0}.{1}'.format(form, relname)) + # If the synchronized module is an utils + # directory, we add it to sys.path + for util_dir in opts['utils_dirs']: + if mod_dir.endswith(util_dir) and mod_dir not in sys.path: + sys.path.append(mod_dir) + touched = bool(ret) if opts['clean_dynamic_modules'] is True: current = set(_listdir_recursively(mod_dir))