(self, inventory_report: Dict, stats_sync: Optional[Dict] = None)
| 281 | return working_sources, export_sources, report |
| 282 | |
| 283 | def prepare_metadata(self, inventory_report: Dict, stats_sync: Optional[Dict] = None) -> Dict: |
| 284 | metadata = _load_json(self.metadata_file, {}) |
| 285 | metadata["inventory"] = inventory_report |
| 286 | now = datetime.now().isoformat() |
| 287 | metadata["last_maintenance"] = now |
| 288 | metadata["last_inventory_rebuild"] = inventory_report.get("timestamp", now) |
| 289 | if stats_sync is not None: |
| 290 | metadata["last_stats_sync"] = stats_sync.get("updated_at") |
| 291 | metadata["last_stats_sync_status"] = stats_sync.get("status") |
| 292 | metadata["last_stats_sync_error"] = stats_sync.get("error") |
| 293 | return metadata |
| 294 | |
| 295 | def update_metadata(self, inventory_report: Dict, stats_sync: Optional[Dict] = None) -> Dict: |
| 296 | metadata = self.prepare_metadata(inventory_report, stats_sync) |
no test coverage detected