Create segment-0 heap file if it does not exist.
(self)
| 421 | return True |
| 422 | |
| 423 | def _init_heap_file(self): |
| 424 | """Create segment-0 heap file if it does not exist.""" |
| 425 | if os.path.exists(self.heap_path): |
| 426 | return True |
| 427 | try: |
| 428 | os.makedirs(os.path.dirname(self.heap_path), exist_ok=True) |
| 429 | with salt.utils.files.fopen(self.heap_path, "wb") as f: |
| 430 | f.flush() |
| 431 | os.fsync(f.fileno()) |
| 432 | except OSError as exc: |
| 433 | log.error("Failed to initialize heap file: %s", exc) |
| 434 | return False |
| 435 | return True |
| 436 | |
| 437 | def _discover_segments(self): |
| 438 | """ |