From c9ad4e7ca8527070321d1106c4b3da16d5444bc7 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 18 Apr 2013 03:40:13 +0100 Subject: [PATCH] `loaded_base_name` and `mod_type_check` default to `None` and in that case, to what's defined for salt. --- salt/loader.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/salt/loader.py b/salt/loader.py index 0eaaec9fab..9d9a889bfd 100644 --- a/salt/loader.py +++ b/salt/loader.py @@ -27,8 +27,8 @@ def _create_loader( ext_dirs=True, ext_type_dirs=None, base_path=None, - loaded_base_name=LOADED_BASE_NAME, - mod_type_check=_mod_type): + loaded_base_name=None, + mod_type_check=None): ''' Creates Loader instance @@ -64,6 +64,12 @@ def _create_loader( if (os.path.isdir(maybe_dir)): cli_module_dirs.insert(0, maybe_dir) + if loaded_base_name is None: + loaded_base_name = LOADED_BASE_NAME + + if mod_type_check is None: + mod_type_check = _mod_type + module_dirs = cli_module_dirs + ext_type_types + [ext_types, sys_types] _generate_module('{0}.int'.format(loaded_base_name)) _generate_module('{0}.int.{1}'.format(loaded_base_name, tag)) @@ -317,7 +323,7 @@ class Loader(object): call modules in an arbitrary directory directly. ''' def __init__(self, module_dirs, opts=dict(), tag='module', - loaded_base_name=LOADED_BASE_NAME, mod_type_check=_mod_type): + loaded_base_name=None, mod_type_check=None): self.module_dirs = module_dirs if '_' in tag: raise LoaderError('Cannot tag loader with an "_"') @@ -331,8 +337,8 @@ class Loader(object): else: self.pillar = {} self.opts = self.__prep_mod_opts(opts) - self.loaded_base_name = loaded_base_name - self.mod_type_check = mod_type_check + self.loaded_base_name = loaded_base_name or LOADED_BASE_NAME + self.mod_type_check = mod_type_check or _mod_type def __prep_mod_opts(self, opts): '''