Commit fd83fcb
committed
nocloud: accept dict-of-strings public-keys format
Some sources serialise public-keys as a dict of {name: key-string}
rather than {name: {'openssh-key': key-string}}. KubeVirt's
accessCredentials sshPublicKey noCloud propagation does this, defining
NoCloudMetadata.PublicSSHKeys as map[string]string [1] and assigning
it directly in readCloudInitNoCloudMetaData [2]. The current third
branch of get_public_keys() then calls .get('openssh-key') on a string
value and raises "'str' object has no attribute 'get'". Accept both
shapes.
[1] https://github.com/kubevirt/kubevirt/blob/623bf15e7553875860ece1a382a9e35bfbd61a26/pkg/cloud-init/cloud-init.go#L84
[2] https://github.com/kubevirt/kubevirt/blob/623bf15e7553875860ece1a382a9e35bfbd61a26/pkg/cloud-init/cloud-init.go#L402-L408
AI-assisted contribution: I reviewed the change and submit it under
the DCO terms at https://github.com/cloudbase/cloudbase-init/blob/master/DCO#L16
(clause (a) — the contribution is mine).
Signed-off-by: mattia-eleuteri <mattia@hidora.io>1 parent e7058ec commit fd83fcb
2 files changed
Lines changed: 20 additions & 1 deletion
File tree
- cloudbaseinit
- metadata/services
- tests/metadata/services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
699 | 705 | | |
700 | 706 | | |
701 | 707 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
519 | 532 | | |
520 | 533 | | |
521 | 534 | | |
| |||
0 commit comments