summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2021-04-03 01:25:23 +0300
committerzsdc <taras@vyos.io>2021-04-03 01:25:23 +0300
commita865fe4c68c9c3d1933fab1fa964d94d6c5d1544 (patch)
treeb777f8f1131e8431679e58af8b895e332afb9c5f
parentff02b77217650789330271fa25b6d585962043c9 (diff)
downloadvyos-cloud-init-a865fe4c68c9c3d1933fab1fa964d94d6c5d1544.tar.gz
vyos-cloud-init-a865fe4c68c9c3d1933fab1fa964d94d6c5d1544.zip
Azure: T3432: Changed workaround for SSH keys on Azure
Appending all the data from `metadata_ds['public-keys']` to a list of public keys is dangerous because some of the other datasources have the same `public-keys` option but use different formats inside. Thus, the workaround was limited to Azure datasource only.
-rw-r--r--cloudinit/config/cc_vyos.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py
index 06f5d263..fa82d75f 100644
--- a/cloudinit/config/cc_vyos.py
+++ b/cloudinit/config/cc_vyos.py
@@ -496,10 +496,9 @@ def handle(name, cfg, cloud, log, _args):
# configure system logins
# Prepare SSH public keys for default user, to be sure that global keys applied to the default account (if it exist)
ssh_keys = metadata_v1['public_ssh_keys']
- # append SSH keys from metadata_ds
- ds_keys = metadata_ds.get('public-keys')
- if ds_keys:
- ssh_keys.extend([ key for key in metadata_ds['public-keys'] ])
+ # Cloud-init before the 20.4 version is not able to fetch SSH public keys from Azure properly, so we need to add them manually
+ if 'Azure' in dsname:
+ ssh_keys.extend(metadata_ds.get('public-keys', []))
# append SSH keys from cloud-config
ssh_keys.extend(cfg.get('ssh_authorized_keys', []))
# Configure authentication for default user account