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 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