| 272 | self.config.hosts.append(current_host) |
| 273 | |
| 274 | def _resolve_includes(self) -> None: |
| 275 | resolved: Dict[Path, List[str]] = {} |
| 276 | base_dir = self.config_path.parent |
| 277 | for pattern in self.config.include_directives: |
| 278 | expanded = os.path.expanduser(pattern) |
| 279 | if not os.path.isabs(expanded): |
| 280 | expanded = str(base_dir / expanded) |
| 281 | |
| 282 | try: |
| 283 | matches = glob.glob(expanded, recursive=False) |
| 284 | if not matches and "**" in expanded: |
| 285 | matches = glob.glob(expanded, recursive=True) |
| 286 | except Exception: |
| 287 | matches = [] |
| 288 | |
| 289 | for path_str in matches: |
| 290 | p = Path(path_str) |
| 291 | try: |
| 292 | with p.open("r", encoding="utf-8") as f: |
| 293 | resolved[p] = f.readlines() |
| 294 | except Exception: |
| 295 | continue |
| 296 | |
| 297 | self.config.includes_resolved = resolved |
| 298 | |
| 299 | def _backup_file(self) -> None: |
| 300 | ts = datetime.now().strftime("%Y%m%d-%H%M%S") |