(dir: &Path, run_id: &str)
| 722 | } |
| 723 | |
| 724 | fn load_lifecycle(dir: &Path, run_id: &str) -> CliResult<Option<ManagedLifecycle>> { |
| 725 | validate_run_id(run_id)?; |
| 726 | let path = lifecycle_path(dir, run_id); |
| 727 | if !path.exists() { |
| 728 | return Ok(None); |
| 729 | } |
| 730 | let data = fs::read_to_string(&path).map_err(|e| { |
| 731 | CliError::Internal(anyhow!( |
| 732 | "failed to read managed lifecycle '{}': {}", |
| 733 | path.display(), |
| 734 | e |
| 735 | )) |
| 736 | })?; |
| 737 | let lifecycle = serde_json::from_str(&data).map_err(|e| { |
| 738 | CliError::Internal(anyhow!( |
| 739 | "failed to parse managed lifecycle '{}': {}", |
| 740 | path.display(), |
| 741 | e |
| 742 | )) |
| 743 | })?; |
| 744 | Ok(Some(lifecycle)) |
| 745 | } |
| 746 | |
| 747 | fn save_lifecycle(dir: &Path, lifecycle: &ManagedLifecycle) -> CliResult<()> { |
| 748 | validate_run_id(&lifecycle.run_id)?; |
no test coverage detected