diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-03-16 13:14:27 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-03-16 13:14:27 -0400 |
commit | 6d8f796239ed635f2e4de97d167e54f74baba2a2 (patch) | |
tree | 00acd09c56db1e622c1d2f94ce13fc80297a662a | |
parent | 3522b7b49368f486f61c220151212f68e9cc9782 (diff) | |
download | vyos-cloud-init-6d8f796239ed635f2e4de97d167e54f74baba2a2.tar.gz vyos-cloud-init-6d8f796239ed635f2e4de97d167e54f74baba2a2.zip |
add supprot for reading public-keys from DataSourcMAAS
-rw-r--r-- | cloudinit/DataSourceMAAS.py | 11 | ||||
-rw-r--r-- | tests/unittests/test_datasource/test_maas.py | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/cloudinit/DataSourceMAAS.py b/cloudinit/DataSourceMAAS.py index 80d3fd6e..61a0038f 100644 --- a/cloudinit/DataSourceMAAS.py +++ b/cloudinit/DataSourceMAAS.py @@ -139,7 +139,7 @@ def read_maas_seed_dir(seed_d): * local-hostname * user-data """ - files = ('local-hostname', 'instance-id', 'user-data') + files = ('local-hostname', 'instance-id', 'user-data', 'public-keys') md = {} if not os.path.isdir(seed_d): @@ -165,11 +165,14 @@ def read_maas_seed_url(seed_url, header_cb=None, timeout=None, be given to urllib2.Request() Expected format of seed_url is are the following files: - * <seed_url>/<version>/instance-id - * <seed_url>/<version>/local-hostname + * <seed_url>/<version>/meta-data/instance-id + * <seed_url>/<version>/meta-data/local-hostname * <seed_url>/<version>/user-data """ - files = ('meta-data/local-hostname', 'meta-data/instance-id', 'user-data') + files = ('meta-data/local-hostname', + 'meta-data/instance-id', + 'meta-data/public-keys', + 'user-data') base_url = "%s/%s" % (seed_url, version) md = {} diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index 01565217..7659dd03 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -29,7 +29,8 @@ class TestMAASDataSource(MockerTestCase): data = {'instance-id': 'i-valid01', 'local-hostname': 'valid01-hostname', - 'user-data': 'valid01-userdata'} + 'user-data': 'valid01-userdata', + 'public-keys': 'ssh-rsa AAAAB3Nz...aC1yc2E= keyname'} my_d = os.path.join(self.tmp, "valid") populate_dir(my_d, data) @@ -99,6 +100,7 @@ class TestMAASDataSource(MockerTestCase): """Verify that valid seed_url is read as such""" valid = {'meta-data/instance-id': 'i-instanceid', 'meta-data/local-hostname': 'test-hostname', + 'meta-data/public-keys': 'test-hostname', 'user-data': 'foodata'} my_seed = "http://example.com/xmeta" |