summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/DataSourceMaaS.py14
-rw-r--r--tests/unittests/test_datasource/test_maas.py14
2 files changed, 14 insertions, 14 deletions
diff --git a/cloudinit/DataSourceMaaS.py b/cloudinit/DataSourceMaaS.py
index c25652b1..88686b13 100644
--- a/cloudinit/DataSourceMaaS.py
+++ b/cloudinit/DataSourceMaaS.py
@@ -137,7 +137,7 @@ def read_maas_seed_dir(seed_d):
* hostname
* user-data
"""
- files = ('hostname', 'instance-id', 'userdata')
+ files = ('hostname', 'instance-id', 'user-data')
md = {}
if not os.path.isdir(seed_d):
@@ -166,7 +166,7 @@ def read_maas_seed_url(seed_url, header_cb=None, timeout=None):
* <seed_url>/hostname
* <seed_url>/user-data
"""
- files = ('hostname', 'instance-id', 'userdata')
+ files = ('hostname', 'instance-id', 'user-data')
md = {}
for fname in files:
@@ -190,23 +190,23 @@ def check_seed_contents(content, seed):
Either return a (userdata, metadata) tuple or
Raise MaasSeedDirMalformed or MaasSeedDirNone
"""
- md_required = ('userdata', 'instance-id', 'hostname')
+ md_required = ('user-data', 'instance-id', 'hostname')
found = content.keys()
if len(content) == 0:
raise MaasSeedDirNone("%s: no data files found" % seed)
- if 'userdata' not in content:
- raise MaasSeedDirMalformed("%s: missing userdata" % seed)
+ if 'user-data' not in content:
+ raise MaasSeedDirMalformed("%s: missing user-data" % seed)
missing = [k for k in md_required if k not in found]
if len(missing):
raise MaasSeedDirMalformed("%s: missing files %s" % (seed, missing))
- userdata = content['userdata']
+ userdata = content['user-data']
md = { }
for (key, val) in content.iteritems():
- if key == 'userdata':
+ if key == 'user-data':
continue
md[key] = val
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index 22374415..dc8964d3 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -26,33 +26,33 @@ class TestMaasDataSource(TestCase):
"""Verify a valid seeddir is read as such"""
data = {'instance-id': 'i-valid01', 'hostname': 'valid01-hostname',
- 'userdata': 'valid01-userdata'}
+ 'user-data': 'valid01-userdata'}
my_d = os.path.join(self.tmp, "valid")
populate_dir(my_d, data)
(userdata, metadata) = read_maas_seed_dir(my_d)
- self.assertEqual(userdata, data['userdata'])
+ self.assertEqual(userdata, data['user-data'])
for key in ('instance-id', 'hostname'):
self.assertEqual(data[key], metadata[key])
# verify that 'userdata' is not returned as part of the metadata
- self.assertFalse(('userdata' in metadata))
+ self.assertFalse(('user-data' in metadata))
def test_seed_dir_valid_extra(self):
"""Verify extra files do not affect seed_dir validity """
data = {'instance-id': 'i-valid-extra',
'hostname': 'valid-extra-hostname',
- 'userdata': 'valid-extra-userdata', 'foo': 'bar'}
+ 'user-data': 'valid-extra-userdata', 'foo': 'bar'}
my_d = os.path.join(self.tmp, "valid_extra")
populate_dir(my_d, data)
(userdata, metadata) = read_maas_seed_dir(my_d)
- self.assertEqual(userdata, data['userdata'])
+ self.assertEqual(userdata, data['user-data'])
for key in ('instance-id', 'hostname'):
self.assertEqual(data[key], metadata[key])
@@ -63,14 +63,14 @@ class TestMaasDataSource(TestCase):
"""Verify that invalid seed_dir raises MaasSeedDirMalformed"""
valid = {'instance-id': 'i-instanceid',
- 'hostname': 'test-hostname', 'userdata': ''}
+ 'hostname': 'test-hostname', 'user-data': ''}
my_based = os.path.join(self.tmp, "valid_extra")
# missing 'userdata' file
my_d = "%s-01" % my_based
invalid_data = copy(valid)
- del invalid_data['userdata']
+ del invalid_data['user-data']
populate_dir(my_d, invalid_data)
self.assertRaises(MaasSeedDirMalformed, read_maas_seed_dir, my_d)