diff options
Diffstat (limited to 'lorrycontroller/confparser.py')
-rw-r--r-- | lorrycontroller/confparser.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lorrycontroller/confparser.py b/lorrycontroller/confparser.py index 6f18de6..d2f9402 100644 --- a/lorrycontroller/confparser.py +++ b/lorrycontroller/confparser.py @@ -92,6 +92,10 @@ class LorryControllerConfig(object): '''Validate a 'lorries' stanza.''' if type(entry.get('globs', None)) != list: self._give_up("Lorries stanzas need lists for their 'globs'") + if entry.get('prefix', None) is None: + entry['prefix'] = u"" + if type(entry['prefix']) != unicode: + self._give_up("Lorry prefixes should be strings.") my_lorries = set() git_base = os.path.join(self.settings['work-area'], 'git') for glob_entry in entry['globs']: @@ -112,9 +116,11 @@ class LorryControllerConfig(object): with open(lorry, "r") as fh: lorry_json = json.load(fh) for name, content in lorry_json.iteritems(): - if self.lorries.get(name, None) is not None: - self._give_up("Lorry repeated: %s" % name) - self.lorries[name] = content + fullname = os.path.join(entry['prefix'], name) + if self.lorries.get(fullname, None) is not None: + self._give_up("Lorry repeated: %s" % fullname) + logging.debug("[%r]=%r" % (fullname, content)) + self.lorries[fullname] = content except Exception, e: logging.debug("Unable to parse %s, because of %s. Moving on" % (lorry, e)) |