Commit 4f55fd3
committed
Fix 'show version' KeyError when sonic_version.yml has missing fields
'show version' crashes with KeyError when debian_version or
kernel_version are missing from sonic_version.yml. This happens in
docker-sonic-vs containers where the version file is generated without
these fields (they are only set during full image builds).
Use .get() with sensible runtime fallbacks:
- debian_version: 'N/A' (not available in container context)
- kernel_version: os.uname().release (actual host kernel at runtime)
- build_version: 'N/A'
- sonic_os_version: 'N/A'
Fixes sonic-net/sonic-buildimage#25765
Signed-off-by: securely1g <securely1g@users.noreply.github.com>1 parent e5f77f6 commit 4f55fd3
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1695 | 1695 | | |
1696 | 1696 | | |
1697 | 1697 | | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
1702 | 1702 | | |
1703 | 1703 | | |
1704 | 1704 | | |
| |||
0 commit comments