From 17f0de08946f5df59a3f3bafa6ce3f417e98cf14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kurlbaum?= Date: Tue, 25 Oct 2016 16:56:09 +0200 Subject: [PATCH] glob directories for easier import --- varstack/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/varstack/__init__.py b/varstack/__init__.py index 04f81ca..e6f0214 100644 --- a/varstack/__init__.py +++ b/varstack/__init__.py @@ -6,6 +6,7 @@ __all__ = [ "Varstack" ] import logging, re, yaml, os +import glob from pprint import pprint try: @@ -43,7 +44,10 @@ def evaluate(self, variables, init_data=None): self.config.update(yaml.safe_load(cfh)) cfh.close() for path in self.config['stack']: - fullpaths = self.__substitutePathVariables(self.config['datadir']+'/'+path+'.yaml', variables) + if path.endswith('/'): + fullpaths = glob.glob(self.config['datadir']+'/'+path+'*.yaml') + else: + fullpaths = self.__substitutePathVariables(self.config['datadir']+'/'+path+'.yaml', variables) if not fullpaths: continue for fullpath in fullpaths: