diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-08-15 13:32:14 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-08-15 13:32:14 -0400 |
commit | b2ee0966793f3a9c7d8e92ce1c13b9583a9a76e7 (patch) | |
tree | 6d9283670e1d7b7966bd585b52cc2ec282fc126a /tests | |
parent | e23861e5a193377023e55da6234e23acd63a521a (diff) | |
parent | e668da729a0f9cd5d93d909a9b44d74cf6925dd5 (diff) | |
download | vyos-cloud-init-b2ee0966793f3a9c7d8e92ce1c13b9583a9a76e7.tar.gz vyos-cloud-init-b2ee0966793f3a9c7d8e92ce1c13b9583a9a76e7.zip |
fix setting of password for a user on azure.
If azure ovf data specified a password, then get that password passed
through to useradd. Also updates the test case to verify that the
value was encrypted correctly.
LP: #1212723
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_datasource/test_azure.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index 06f8a5d2..1ca6a79d 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -2,6 +2,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceAzure from tests.unittests.helpers import populate_dir +import crypt import base64 from mocker import MockerTestCase import os @@ -207,11 +208,15 @@ class TestAzureDataSource(MockerTestCase): self.assertTrue('default_user' in dsrc.cfg['system_info']) defuser = dsrc.cfg['system_info']['default_user'] - # default user shoudl be updated for password and username - # and should not be locked. + # default user should be updated username and should not be locked. self.assertEqual(defuser['name'], odata['UserName']) - self.assertEqual(defuser['password'], odata['UserPassword']) self.assertFalse(defuser['lock_passwd']) + # passwd is crypt formated string $id$salt$encrypted + # encrypting plaintext with salt value of everything up to final '$' + # should equal that after the '$' + pos = defuser['passwd'].rfind("$") + 1 + self.assertEqual(defuser['passwd'], + crypt.crypt(odata['UserPassword'], defuser['passwd'][0:pos])) def test_userdata_found(self): mydata = "FOOBAR" |