summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnh Vo <anhvo@microsoft.com>2020-11-19 00:35:46 -0500
committerGitHub <noreply@github.com>2020-11-18 22:35:46 -0700
commiteea754492f074e00b601cf77aa278e3623857c5a (patch)
tree48a02090a5f9e9bc8024353cd8da1186162a0b4d /tests
parent49d5de92d60af4ef483a67bd4c75148e6fdc58a3 (diff)
downloadvyos-cloud-init-eea754492f074e00b601cf77aa278e3623857c5a.tar.gz
vyos-cloud-init-eea754492f074e00b601cf77aa278e3623857c5a.zip
DataSourceAzure: update password for defuser if exists (#671)
cc_set_password will only update the password for the default user if cfg['password'] is set. The existing code of datasource Azure will fail to update the default user's password because it does not set that metadata. If the default user doesn't exist in the image, the current code works fine because the password is set during user create and not in cc_set_password
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_azure.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index d9752ab7..534314aa 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -1080,6 +1080,9 @@ scbus-1 on xpt0 bus 0
crypt.crypt(odata['UserPassword'],
defuser['passwd'][0:pos]))
+ # the same hashed value should also be present in cfg['password']
+ self.assertEqual(defuser['passwd'], dsrc.cfg['password'])
+
def test_user_not_locked_if_password_redacted(self):
odata = {'HostName': "myhost", 'UserName': "myuser",
'UserPassword': dsaz.DEF_PASSWD_REDACTION}