(self, data)
| 289 | data = {} |
| 290 | |
| 291 | def load(self, data): |
| 292 | if data is not None: |
| 293 | self.data = data |
| 294 | self.type = self.data["type"] |
| 295 | updateDataBag(self) |
| 296 | return |
| 297 | filename = '{cache_location}/{json_file}'.format(cache_location=self.configCache, json_file=self.fileName) |
| 298 | try: |
| 299 | handle = open(filename) |
| 300 | except IOError as exception: |
| 301 | error_message = ("Exception occurred with the following exception error '{error}'. Could not open '{filename}'. " |
| 302 | "It seems that the file has already been moved.".format(error=exception, filename=filename)) |
| 303 | logging.error(error_message) |
| 304 | else: |
| 305 | logging.info("Continuing with the processing of file '{filename}'".format(filename=filename)) |
| 306 | |
| 307 | self.data = json.load(handle) |
| 308 | self.type = self.data["type"] |
| 309 | handle.close() |
| 310 | if self.keep: |
| 311 | self.__moveFile(filename, self.configCache + "/processed") |
| 312 | else: |
| 313 | logging.debug("Processed file deleted: %s and not kept in /processed", filename) |
| 314 | os.remove(filename) |
| 315 | updateDataBag(self) |
| 316 | |
| 317 | def setFile(self, name): |
| 318 | self.fileName = name |
no test coverage detected