From 2ecefdf51cd93b593bea450b4d751021da91e748 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 27 Mar 2014 10:03:27 -0400 Subject: change 'default' encoding to be "None" Instead of just trying to see if userdata decodes as the indication that it should be encoded, the user must explicitly set this. The "just try it" will fail in the case where the user had other use of user-data and wanted a blob of data to go through unrecognized by cloud-init. In cases where there can be mistake in automatic behavior, and some users may be relaying on old behavior, its best to just require explicit use. --- tests/unittests/test_datasource/test_opennebula.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/unittests/test_datasource/test_opennebula.py') diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index 47e7acbc..ec6b752b 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -175,14 +175,15 @@ class TestOpenNebulaDataSource(MockerTestCase): self.assertTrue('userdata' in results) self.assertEqual(USER_DATA, results['userdata']) - def test_user_data_default_encoding(self): + def test_user_data_encoding_required_for_decode(self): + b64userdata = b64encode(USER_DATA) for k in ('USER_DATA', 'USERDATA'): my_d = os.path.join(self.tmp, k) - populate_context_dir(my_d, {k: b64encode(USER_DATA)}) + populate_context_dir(my_d, {k: b64userdata}) results = ds.read_context_disk_dir(my_d) self.assertTrue('userdata' in results) - self.assertEqual(USER_DATA, results['userdata']) + self.assertEqual(b64userdata, results['userdata']) def test_user_data_base64_encoding(self): for k in ('USER_DATA', 'USERDATA'): -- cgit v1.2.3