def load_keywords(keywords_path=None): all_keywords = dict() keyword_paths = (os.path.abspath("/etc/dyson/keywords"), os.path.abspath( os.path.join(os.path.dirname(os.path.curdir), "keywords"))) if keywords_path is not None: all_keywords = merge_dict(load_keywords(), _load_keywords_from_path(keywords_path)) else: for keyword_path in keyword_paths: all_keywords = merge_dict(all_keywords, _load_keywords_from_path(keyword_path)) return all_keywords
def load_modules(mod_path=None): all_modules = dict() # each path, local dir last to override any. modules_paths = ( os.path.abspath(os.path.join(os.path.dirname(__file__), "core")), os.path.abspath(os.path.join(os.path.dirname(__file__), "extras")), os.path.abspath("/etc/dyson/modules"), os.path.abspath(os.path.join(os.path.dirname(os.path.curdir), "modules")) ) if mod_path is not None: # load specific modules from a path. all_modules = merge_dict(load_modules(), _load_modules_from(mod_path)) else: for module_path in modules_paths: all_modules = merge_dict(all_modules, _load_modules_from(module_path)) return all_modules
def _resolve_test_vars(self): test_vars = dict() vars_files = ( glob.iglob(os.path.join(self._test_path, "vars", "*.yml"), recursive=True), glob.iglob(os.path.join(self._test_path, "vars", "*.yaml"), recursive=True), glob.iglob(os.path.join(self._test_path, "vars", "*.json"), recursive=True), ) for possible_var_files in vars_files: for vars_file in possible_var_files: if os.path.exists(vars_file): test_vars = merge_dict( test_vars, self._data_loader.load_file(vars_file)) return iterate_dict(test_vars, variable_manager=self._variable_manager, parse_kv=False)