def _read()

in hostfactory/host_provider/src/util.py [0:0]


    def _read(self, do_lock=True):
        if do_lock and not self._lock():
            raise RuntimeError("Could not get lock %s" % self.lockpath)
        
        if os.path.exists(self.path):
            try:
                self.data = load_json(self.path)
            except Exception:
                self.logger.exception("Could not reload %s - hosts may need to be manually removed from the system's hosts.json file." % self.path)
                self.data = {}
        else:
            self.data = {}
        
        if do_lock:
            self._unlock()
            
        return self.data