diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-11-12 12:26:49 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-11-12 12:26:49 -0500 |
commit | 7ba753720cd95bfca61c82445cf9c7882fe5d6f1 (patch) | |
tree | 1a39ce4eaa65be910c10b0155f5d4c463e6a4027 /cloudinit/sources/DataSourceConfigDrive.py | |
parent | 8730e143ec07372107d794abe9f4857ead6d4718 (diff) | |
download | vyos-cloud-init-7ba753720cd95bfca61c82445cf9c7882fe5d6f1.tar.gz vyos-cloud-init-7ba753720cd95bfca61c82445cf9c7882fe5d6f1.zip |
config-drive-v2: support public keys
This does a couple things:
* separates out the 'normalize_public_keys' from the DataSource's get_public_ssh_keys
* uses that from config-drive datasource
* supports config drive v1 or v2 public-keys
* adds a test.
LP: #1077700
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index 9729cfb9..c7826851 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -219,9 +219,10 @@ class DataSourceConfigDrive(sources.DataSource): return True def get_public_ssh_keys(self): - if not 'public-keys' in self.metadata: - return [] - return self.metadata['public-keys'] + name = "public_keys" + if self.version == 1: + name = "public-keys" + return sources.normalize_pubkey_data(self.metadata.get(name)) class DataSourceConfigDriveNet(DataSourceConfigDrive): |