Commit 0eec10c
committed
feat(image): add property support to create/update/show
The CLI could not set or update custom Glance image properties
(`os_distro`, `os_version`, `hw_qemu_guest_agent`,
`cinder_img_volume_type`, …), which made inter-cloud image migration
lossy: properties present on the source image were silently dropped
on re-upload.
Three commands gain matching surface:
- `orca image create --property KEY=VALUE` (repeatable). Properties
ride on the Glance v2 POST body as top-level keys.
- `orca image update --property KEY=VALUE` and `--remove-property KEY`
(both repeatable), composable into a single atomic JSON-Patch.
Add-vs-replace is decided after fetching the current image so
untouched properties survive. Removes are strict by default and
turn idempotent under `--ignore-missing`.
- `orca image show` now surfaces every custom property Glance returns
plus the integrity fields (`checksum`, `os_hash_algo`,
`os_hash_value`, `direct_url`, `tags`): a `Properties` sub-table
in table format; a top-level `"properties"` aggregate in JSON; and
`KEY VALUE` lines in value format. JSON dual-renders each custom
property at the root *and* under `properties` so existing scripts
doing `jq .os_distro` keep working alongside the new
`jq .properties.os_distro`.
Property keys are validated client-side against Glance's
`^[A-Za-z0-9_:.\-]{1,255}$` schema before any HTTP round-trip — a
malformed key fails fast with a friendly error instead of an opaque
Glance 400. Only the first `=` splits a value, so URL-like values
(`--property url=https://x?a=1&b=2`) survive intact.
Tests cover the round-trip on create, untouched-on-update preservation
(only the changed key appears in the JSON-Patch), strict + idempotent
remove modes, key validation aborting before any HTTP write, value
preservation for `=`-bearing strings, and the three show formats
including the JSON dual-render rétrocompat.1 parent 762117f commit 0eec10c
4 files changed
Lines changed: 535 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
7 | 28 | | |
8 | 29 | | |
9 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
| |||
276 | 284 | | |
277 | 285 | | |
278 | 286 | | |
279 | | - | |
| 287 | + | |
280 | 288 | | |
281 | 289 | | |
282 | | - | |
| 290 | + | |
283 | 291 | | |
284 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
285 | 308 | | |
286 | 309 | | |
287 | 310 | | |
288 | 311 | | |
289 | 312 | | |
290 | | - | |
| 313 | + | |
291 | 314 | | |
292 | 315 | | |
293 | 316 | | |
| |||
429 | 452 | | |
430 | 453 | | |
431 | 454 | | |
432 | | - | |
| 455 | + | |
433 | 456 | | |
434 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
435 | 464 | | |
436 | 465 | | |
437 | 466 | | |
438 | 467 | | |
439 | 468 | | |
440 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
441 | 473 | | |
442 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
443 | 481 | | |
444 | 482 | | |
445 | 483 | | |
| |||
0 commit comments