def getTemplates(self): machineTemplates = {} for d in self._templateDirs: files = listPath(d) for f in files: if os.path.isfile(f) and os.path.splitext(os.path.basename(f))[1] == ".template": try: openedFile = open(os.path.join(f), "r") template = yaml.load(openedFile) machineTemplates["{0}:{1}".format(template.getName(),template.getVersion())] = template REGISTRYLOGGER.debug("Template stored in '{0}' loaded".format(f)) except Exception as e: REGISTRYLOGGER.warning("Unable to load template stored in '{0}: {1}".format(f,str(e))) REGISTRYLOGGER.debug(traceback.format_exc()) return machineTemplates
def getTemplates(self): machineTemplates = {} for d in self._templateDirs: files = listPath(d) for f in files: if os.path.isfile(f) and os.path.splitext( os.path.basename(f))[1] == ".template": try: openedFile = open(os.path.join(f), "r") template = yaml.load(openedFile) machineTemplates["{0}:{1}".format( template.getName(), template.getVersion())] = template REGISTRYLOGGER.debug( "Template stored in '{0}' loaded".format(f)) except Exception as e: REGISTRYLOGGER.warning( "Unable to load template stored in '{0}: {1}". format(f, str(e))) REGISTRYLOGGER.debug(traceback.format_exc()) return machineTemplates