def getInstances(self): _instances = {} for d in self._instanceDirs: path = listPath(d) # For each path to scan for iDir in path: # Check if the file exists and if there is a VagrantFile and a config file in it if os.path.isdir(iDir) and os.path.exists( os.path.join(iDir, "Vagrantfile")) and os.path.exists( os.path.join(iDir, MACHINATION_CONFIGFILE_NAME)): try: filename = os.path.join(iDir, MACHINATION_CONFIGFILE_NAME) openedFile = open(filename, "r") instance = yaml.load(openedFile) _instances[instance.getName()] = instance REGISTRYLOGGER.debug( "Instance stored in '{0}' loaded".format(filename)) except Exception as e: REGISTRYLOGGER.error( "Unable to load instance stored in '{0}': {1}". format(iDir, str(e))) REGISTRYLOGGER.debug(traceback.format_exc()) return _instances
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 getInstances(self): _instances = {} for d in self._instanceDirs: path = listPath(d) # For each path to scan for iDir in path: # Check if the file exists and if there is a VagrantFile and a config file in it if os.path.isdir(iDir) and os.path.exists(os.path.join(iDir, "Vagrantfile")) and os.path.exists(os.path.join(iDir, MACHINATION_CONFIGFILE_NAME)): try: filename = os.path.join(iDir, MACHINATION_CONFIGFILE_NAME) openedFile = open(filename, "r") instance = yaml.load(openedFile) _instances[instance.getName()] = instance REGISTRYLOGGER.debug("Instance stored in '{0}' loaded".format(filename)) except Exception as e: REGISTRYLOGGER.error("Unable to load instance stored in '{0}': {1}".format(iDir, str(e))) REGISTRYLOGGER.debug(traceback.format_exc()) return _instances
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