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
1 file changed