Commit 5dfd11e
authored
Fix 'show version' KeyError when sonic_version.yml has missing fields (#4324)
'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 4c77f9d commit 5dfd11e
2 files changed
+34
-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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
252 | 282 | | |
253 | 283 | | |
254 | 284 | | |
| |||
0 commit comments