diff --git a/salt/roster/range.py b/salt/roster/range.py index 0633d56e389..247fb51ced6 100644 --- a/salt/roster/range.py +++ b/salt/roster/range.py @@ -15,16 +15,21 @@ import fnmatch import logging +import salt.loader + log = logging.getLogger(__name__) # Try to import range from https://github.com/ytoolshed/range HAS_RANGE = False try: + salt.loader.LOAD_LOCK.acquire() import seco.range HAS_RANGE = True except ImportError: log.warning("Unable to load range library") +finally: + salt.loader.LOAD_LOCK.release() # pylint: enable=import-error diff --git a/salt/utils/roster_matcher.py b/salt/utils/roster_matcher.py index c424c63bb0e..39e57f78f17 100644 --- a/salt/utils/roster_matcher.py +++ b/salt/utils/roster_matcher.py @@ -8,14 +8,19 @@ import logging import re +import salt.loader + # Try to import range from https://github.com/ytoolshed/range HAS_RANGE = False try: + salt.loader.LOAD_LOCK.acquire() import seco.range HAS_RANGE = True except ImportError: pass +finally: + salt.loader.LOAD_LOCK.release() # pylint: enable=import-error