From 68d15ada4b20b17bbe564126e165d9dacc01d71c Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 5 May 2023 09:07:14 +0200 Subject: [PATCH] Switch from json.loads to yaml.safe_load for decoded usernames In the rotate password test, the results from the action return a list of strings that are deliminted by single quotes. This isn't compatible with json.loads(), but yaml.safe_load() is able to load the string as an array of strings. (cherry picked from commit 0fe8e9d666dc79c99217ea86f74e7251474e6c52) --- zaza/openstack/charm_tests/mysql/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/mysql/tests.py b/zaza/openstack/charm_tests/mysql/tests.py index 4a2d33b13..c6e24a5bf 100644 --- a/zaza/openstack/charm_tests/mysql/tests.py +++ b/zaza/openstack/charm_tests/mysql/tests.py @@ -21,6 +21,7 @@ import re import tempfile import tenacity +import yaml import zaza.charm_lifecycle.utils as lifecycle_utils import zaza.model @@ -597,7 +598,7 @@ def _get_password_from_keystone_leader(): 'list-service-usernames', action_params={} ) - usernames = json.loads(action.data['results']['usernames']) + usernames = yaml.safe_load(action.data['results']['usernames']) logging.info("... usernames: %s", ', '.join(usernames)) self.assertIn('keystone', usernames)