(self)
| 272 | self.load() |
| 273 | |
| 274 | def load(self): |
| 275 | self._config = configparser.ConfigParser(interpolation=None) |
| 276 | with self.config_path.open() as fd: |
| 277 | self._config.read_file(fd) |
| 278 | self._check_upgrade(self.config_path) |
| 279 | self.id = self._config.get("cache", "repository") |
| 280 | self.manifest_id = hex_to_bin(self._config.get("cache", "manifest")) |
| 281 | self.ignored_features = set(parse_stringified_list(self._config.get("cache", "ignored_features", fallback=""))) |
| 282 | self.mandatory_features = set( |
| 283 | parse_stringified_list(self._config.get("cache", "mandatory_features", fallback="")) |
| 284 | ) |
| 285 | try: |
| 286 | self.integrity = dict(self._config.items("integrity")) |
| 287 | if self._config.get("cache", "manifest") != self.integrity.pop("manifest"): |
| 288 | # The cache config file is updated (parsed with ConfigParser, the state of the ConfigParser |
| 289 | # is modified and then written out.), not re-created. |
| 290 | # Thus, older versions will leave our [integrity] section alone, making the section's data invalid. |
| 291 | # Therefore, we also add the manifest ID to this section and |
| 292 | # can discern whether an older version interfered by comparing the manifest IDs of this section |
| 293 | # and the main [cache] section. |
| 294 | self.integrity = {} |
| 295 | logger.warning("Cache integrity data not available: old Borg version modified the cache.") |
| 296 | except configparser.NoSectionError: |
| 297 | logger.debug("Cache integrity: No integrity data found (files, chunks). Cache is from old version.") |
| 298 | self.integrity = {} |
| 299 | |
| 300 | def save(self, manifest=None): |
| 301 | if manifest: |
no test coverage detected