Skip to content

Commit 6d8f796

Browse files
committed
add supprot for reading public-keys from DataSourcMAAS
1 parent 3522b7b commit 6d8f796

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cloudinit/DataSourceMAAS.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def read_maas_seed_dir(seed_d):
139139
* local-hostname
140140
* user-data
141141
"""
142-
files = ('local-hostname', 'instance-id', 'user-data')
142+
files = ('local-hostname', 'instance-id', 'user-data', 'public-keys')
143143
md = {}
144144

145145
if not os.path.isdir(seed_d):
@@ -165,11 +165,14 @@ def read_maas_seed_url(seed_url, header_cb=None, timeout=None,
165165
be given to urllib2.Request()
166166
167167
Expected format of seed_url is are the following files:
168-
* <seed_url>/<version>/instance-id
169-
* <seed_url>/<version>/local-hostname
168+
* <seed_url>/<version>/meta-data/instance-id
169+
* <seed_url>/<version>/meta-data/local-hostname
170170
* <seed_url>/<version>/user-data
171171
"""
172-
files = ('meta-data/local-hostname', 'meta-data/instance-id', 'user-data')
172+
files = ('meta-data/local-hostname',
173+
'meta-data/instance-id',
174+
'meta-data/public-keys',
175+
'user-data')
173176

174177
base_url = "%s/%s" % (seed_url, version)
175178
md = {}

tests/unittests/test_datasource/test_maas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def test_seed_dir_valid(self):
2929

3030
data = {'instance-id': 'i-valid01',
3131
'local-hostname': 'valid01-hostname',
32-
'user-data': 'valid01-userdata'}
32+
'user-data': 'valid01-userdata',
33+
'public-keys': 'ssh-rsa AAAAB3Nz...aC1yc2E= keyname'}
3334

3435
my_d = os.path.join(self.tmp, "valid")
3536
populate_dir(my_d, data)
@@ -99,6 +100,7 @@ def test_seed_url_valid(self):
99100
"""Verify that valid seed_url is read as such"""
100101
valid = {'meta-data/instance-id': 'i-instanceid',
101102
'meta-data/local-hostname': 'test-hostname',
103+
'meta-data/public-keys': 'test-hostname',
102104
'user-data': 'foodata'}
103105

104106
my_seed = "http://example.com/xmeta"

0 commit comments

Comments
 (0)