Skip to content

Commit

Permalink
Switch from json.loads to yaml.safe_load for decoded usernames
Browse files Browse the repository at this point in the history
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 0fe8e9d)
  • Loading branch information
ajkavanagh authored and freyes committed Sep 21, 2023
1 parent c2526b2 commit 68d15ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zaza/openstack/charm_tests/mysql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import re
import tempfile
import tenacity
import yaml

import zaza.charm_lifecycle.utils as lifecycle_utils
import zaza.model
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 68d15ad

Please sign in to comment.