commit | b58096308fc6258085170749d3ce8f9361ca8f14 | [log] [tgz] |
---|---|---|
author | Felipe Monteiro <felipe.monteiro@att.com> | Thu Oct 26 04:12:12 2017 +0100 |
committer | Felipe Monteiro <felipe.monteiro@att.com> | Thu Oct 26 04:12:12 2017 +0100 |
tree | 257ac66f05370191cb3ffbd04d7d11775751cd05 | |
parent | 21db8fca4a06b8bf799acc2fa0c03672242827d9 [diff] [blame] |
Fix TypeError being raised by json.dumps in policy_authority This PS also catches TypeError raised by json.dumps if the policy data is malformed. For example, right now in Cinder, a policy action defined in code is mistakenly a tuple [0] (which is a bug [1]) causing json.dumps to throw a TypeError because a key in the dict is a tuple rather than a string. [0] https://github.com/openstack/cinder/blob/c6a82637fb777cec8df93ce02b2d65e8bb54c247/cinder/policies/capabilities.py#L21 [1] I1d924da3504861f027273d3319e5cf6c485d1d37 Change-Id: Idf05dc97a932cdbff2a336a91026d8104b0ec243 Depends-On: I1d924da3504861f027273d3319e5cf6c485d1d37
diff --git a/patrole_tempest_plugin/policy_authority.py b/patrole_tempest_plugin/policy_authority.py index d2d07c0..0a1aa13 100644 --- a/patrole_tempest_plugin/policy_authority.py +++ b/patrole_tempest_plugin/policy_authority.py
@@ -225,7 +225,7 @@ try: policy_data = json.dumps(policy_data) - except ValueError: + except (TypeError, ValueError): error_message = 'Policy file for {0} service is invalid.'.format( service) raise rbac_exceptions.RbacParsingException(error_message)