(dir: &Path, run_id: &str)
| 484 | } |
| 485 | |
| 486 | fn load_lifecycle(dir: &Path, run_id: &str) -> CliResult<Option<ManagedLifecycle>> { |
| 487 | validate_run_id(run_id)?; |
| 488 | let path = lifecycle_path(dir, run_id); |
| 489 | if !path.exists() { |
| 490 | return Ok(None); |
| 491 | } |
| 492 | let data = fs::read_to_string(&path).map_err(|e| { |
| 493 | CliError::Internal(anyhow!( |
| 494 | "failed to read managed lifecycle '{}': {}", |
| 495 | path.display(), |
| 496 | e |
| 497 | )) |
| 498 | })?; |
| 499 | let lifecycle = serde_json::from_str(&data).map_err(|e| { |
| 500 | CliError::Internal(anyhow!( |
| 501 | "failed to parse managed lifecycle '{}': {}", |
| 502 | path.display(), |
| 503 | e |
| 504 | )) |
| 505 | })?; |
| 506 | Ok(Some(lifecycle)) |
| 507 | } |
| 508 | |
| 509 | fn save_lifecycle(dir: &Path, lifecycle: &ManagedLifecycle) -> CliResult<()> { |
| 510 | validate_run_id(&lifecycle.run_id)?; |
no test coverage detected