diff options
author | PORTE Loïc <lporte@scaleway.com> | 2018-12-20 21:49:09 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2018-12-20 21:49:09 +0000 |
commit | a809b25c959228ff612ae8e6aaae215bdc028c64 (patch) | |
tree | 2e9f4bb9de38b7b88df56ee93dee0e414b3cad46 /cloudinit/sources/DataSourceScaleway.py | |
parent | d4d11c78e5e78999356fd0c3d124b5a298735b65 (diff) | |
download | vyos-cloud-init-a809b25c959228ff612ae8e6aaae215bdc028c64.tar.gz vyos-cloud-init-a809b25c959228ff612ae8e6aaae215bdc028c64.zip |
Scaleway: Support ssh keys provided inside an instance tag.
The change here will utilize ssh keys found inside an instance's tag.
The tag value must start with 'AUTHORIZED_KEY'.
Diffstat (limited to 'cloudinit/sources/DataSourceScaleway.py')
-rw-r--r-- | cloudinit/sources/DataSourceScaleway.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceScaleway.py b/cloudinit/sources/DataSourceScaleway.py index 9dc4ab23..b573b382 100644 --- a/cloudinit/sources/DataSourceScaleway.py +++ b/cloudinit/sources/DataSourceScaleway.py @@ -253,7 +253,16 @@ class DataSourceScaleway(sources.DataSource): return self.metadata['id'] def get_public_ssh_keys(self): - return [key['key'] for key in self.metadata['ssh_public_keys']] + ssh_keys = [key['key'] for key in self.metadata['ssh_public_keys']] + + akeypre = "AUTHORIZED_KEY=" + plen = len(akeypre) + for tag in self.metadata.get('tags', []): + if not tag.startswith(akeypre): + continue + ssh_keys.append(tag[:plen].replace("_", " ")) + + return ssh_keys def get_hostname(self, fqdn=False, resolve_ip=False, metadata_only=False): return self.metadata['hostname'] |