diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-03-01 11:14:31 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-03-01 11:14:31 -0500 |
commit | 1676825c229e3939ec5b06c494bdcb56d39dddb1 (patch) | |
tree | 855c04a9f8a9d71ee3efc367151fca38e26e8b96 /cloudinit | |
parent | a805702b98bbcafdf0b61c51a483e5f98b2bcab2 (diff) | |
download | vyos-cloud-init-1676825c229e3939ec5b06c494bdcb56d39dddb1.tar.gz vyos-cloud-init-1676825c229e3939ec5b06c494bdcb56d39dddb1.zip |
return public-keys as a list if it is a list
if public-keys in metadata are a list (rather than a dict), then
return them as such.
This allows populating NoCloud keys with:
public-keys:
- ssh-rsa .... myname.mylabel
- ssh-dsa .... myname.mylabel2
Or:
cat <<EOF
public-keys:
$(ssh-add -L | sed 's,^\(.*\), - "\1",')
EOF
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/DataSource.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py index f38e3b20..1bcb9c10 100644 --- a/cloudinit/DataSource.py +++ b/cloudinit/DataSource.py @@ -72,6 +72,9 @@ class DataSource: if isinstance(self.metadata['public-keys'], str): return([self.metadata['public-keys'], ]) + if isinstance(self.metadata['public-keys'], list): + return(self.metadata['public-keys']) + for _keyname, klist in self.metadata['public-keys'].items(): # lp:506332 uec metadata service responds with # data that makes boto populate a string for 'klist' rather |