wido opened a new pull request, #14164:
URL: https://github.com/apache/cloudstack/pull/14164

   ### Description
   
   An Instance with more than one SSH keypair receives its keys as one 
newline-joined string. The OpenStack `meta_data.json` builder wrote that string 
as a single key: `keys` held one object and `public_keys` one entry whose value 
contained both keys with a newline in between. cloud-init treats every 
`public_keys` value as one key and never splits it, so only the first key 
worked at best. Present since multiple SSH keys were introduced in 4.17 (#5965).
   
   The builder now emits one `keys` object and one `public_keys` entry per key. 
A key is named after its comment when it has one that no earlier key used, 
otherwise `key` for a single key and `key0`, `key1`, ... for several.
   
   Output for an Instance with two keys, the second one with a comment:
   
   ```json
   {
     "keys": [
       {"type": "ssh", "data": "ssh-ed25519 AAAA...bsP2", "name": "key0"},
       {"type": "ssh", "data": "ssh-ed25519 AAAA...LOn user@laptop", "name": 
"user@laptop"}
     ],
     "public_keys": {
       "key0": "ssh-ed25519 AAAA...bsP2",
       "user@laptop": "ssh-ed25519 AAAA...LOn user@laptop"
     }
   }
   ```
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   - [x] Major
   
   ### How Has This Been Tested?
   
   Unit tests added to `ConfigDriveBuilderTest` for a single key, a key with a 
comment, two keys, duplicate comments with blank lines, and untouched other 
metadata. Observed on a KVM Instance with two keypairs: `meta_data.json` on the 
ConfigDrive had both keys in one string and cloud-init installed neither 
correctly.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to