Commit 4810592
committed
Merge #226: feat: validate SSH key paths must be absolute
0ded857 feat: [#225] validate SSH key paths must be absolute (Jose Celano)
Pull request description:
Fixes #225
## Summary
This PR implements validation to ensure SSH key paths are absolute during `create environment` command, preventing failures later during `configure` and other commands.
## Changes
- **Validation Logic**: Added `is_absolute()` checks for both private and public SSH key paths in `SshCredentialsConfig::new()`
- **Error Handling**: Added two new error variants:
- `RelativePrivateKeyPath` - for relative private key paths
- `RelativePublicKeyPath` - for relative public key paths
- **Error Messages**: Comprehensive help text with:
- Clear explanation of the problem
- `realpath` command examples for fixing
- Rationale for why absolute paths are required
- **Tests**: Added 5 new unit tests demonstrating validation behavior
- **Test Updates**: Updated 23 existing tests to use absolute paths via `CARGO_MANIFEST_DIR`
- **Doc Examples**: Marked 6 doc examples as `no_run` to prevent execution
## Validation
✅ All 1429 unit tests passing
✅ All 315 doctests passing
✅ All pre-commit checks passing
✅ Manual E2E testing confirmed:
- Relative private key path → rejected with clear error
- Relative public key path → rejected with clear error
- Absolute paths → accepted and environment created successfully
## Example Error Output
```
❌ Create command failed: Configuration validation failed: SSH private key path must be absolute: "fixtures/testing_rsa"
SSH private key path must be absolute.
Fix:
1. Convert relative path to absolute path:
Use the `realpath` command to get the absolute path:
realpath <your-relative-path>
Example:
- Current (relative): fixtures/testing_rsa
- Command: realpath fixtures/testing_rsa
- Result: /home/user/project/fixtures/testing_rsa
2. Update your configuration file with the absolute path
```
## Benefits
- **Fail Fast**: Errors caught immediately during config parsing, before any infrastructure operations
- **Clear Guidance**: Users get actionable error messages with specific fix instructions
- **Prevents Later Failures**: Eliminates cryptic SSH failures during `configure` and subsequent commands
- **Multi-command Safety**: Ensures paths work correctly across different working directories
ACKs for top commit:
josecelano:
ACK 0ded857
Tree-SHA512: db3327215db34f23da59010b5b11cb4c72e5a9d23b2f66ea74fa8d1b03fa2f6b173ffcda10e2d84fe908a90494bf67e23b76b5c6224e4a892c990f9de1ee71ffFile tree
4 files changed
+318
-56
lines changed- src/application/command_handlers/create/config
4 files changed
+318
-56
lines changedLines changed: 63 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
614 | 620 | | |
615 | 621 | | |
616 | 622 | | |
617 | 623 | | |
618 | 624 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
| 625 | + | |
625 | 626 | | |
626 | 627 | | |
627 | 628 | | |
| |||
640 | 641 | | |
641 | 642 | | |
642 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
643 | 650 | | |
644 | 651 | | |
645 | 652 | | |
646 | 653 | | |
647 | 654 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
| 655 | + | |
654 | 656 | | |
655 | 657 | | |
656 | 658 | | |
| |||
667 | 669 | | |
668 | 670 | | |
669 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
670 | 678 | | |
671 | 679 | | |
672 | 680 | | |
673 | 681 | | |
674 | 682 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
| 683 | + | |
681 | 684 | | |
682 | 685 | | |
683 | 686 | | |
| |||
695 | 698 | | |
696 | 699 | | |
697 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
698 | 707 | | |
699 | 708 | | |
700 | 709 | | |
701 | 710 | | |
702 | 711 | | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
| 712 | + | |
709 | 713 | | |
710 | 714 | | |
711 | 715 | | |
| |||
724 | 728 | | |
725 | 729 | | |
726 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
727 | 737 | | |
728 | 738 | | |
729 | 739 | | |
730 | 740 | | |
731 | 741 | | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
| 742 | + | |
738 | 743 | | |
739 | 744 | | |
740 | 745 | | |
| |||
754 | 759 | | |
755 | 760 | | |
756 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
757 | 768 | | |
758 | 769 | | |
759 | 770 | | |
760 | 771 | | |
761 | 772 | | |
762 | 773 | | |
763 | | - | |
764 | | - | |
| 774 | + | |
| 775 | + | |
765 | 776 | | |
766 | 777 | | |
767 | 778 | | |
| |||
782 | 793 | | |
783 | 794 | | |
784 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
785 | 801 | | |
786 | 802 | | |
787 | 803 | | |
788 | 804 | | |
789 | 805 | | |
790 | 806 | | |
791 | 807 | | |
792 | | - | |
| 808 | + | |
793 | 809 | | |
794 | 810 | | |
795 | 811 | | |
| |||
810 | 826 | | |
811 | 827 | | |
812 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
813 | 834 | | |
814 | 835 | | |
815 | 836 | | |
816 | 837 | | |
817 | 838 | | |
818 | 839 | | |
819 | | - | |
| 840 | + | |
820 | 841 | | |
821 | 842 | | |
822 | 843 | | |
| |||
840 | 861 | | |
841 | 862 | | |
842 | 863 | | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
843 | 869 | | |
844 | 870 | | |
845 | 871 | | |
846 | 872 | | |
847 | 873 | | |
848 | 874 | | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
| 875 | + | |
855 | 876 | | |
856 | 877 | | |
857 | 878 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
| |||
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
204 | 272 | | |
205 | 273 | | |
206 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
0 commit comments