summaryrefslogtreecommitdiff
path: root/keystonemiddleware/audit
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@gmail.com>2016-07-04 12:42:16 +1000
committerSteve Martinelli <s.martinelli@gmail.com>2016-07-09 02:34:20 +0000
commit0d1fc6c81fa35e7f56e64cf22cea56bca7981930 (patch)
treec3935232614d350af1410c9750aab435557e4944 /keystonemiddleware/audit
parent29709a4aaf9f8851a11234380cc67285840f0216 (diff)
downloadkeystonemiddleware-0d1fc6c81fa35e7f56e64cf22cea56bca7981930.tar.gz
Use jsonutils instead of ast for loading the service catalog
AST! Never AST! The service catalog set from auth_token middleware is a json blob not a python blob and should be decoded as such. This brings up the problem that the service catalog specified in the tests is not actually valid JSON. In future I'll attempt to change this over to using the auth_token fixture instead of a custom environment dictionary. Change-Id: Ic9ab68f7d41d19d3595a3ddbbb2e233f57ef52c8
Diffstat (limited to 'keystonemiddleware/audit')
-rw-r--r--keystonemiddleware/audit/_api.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/keystonemiddleware/audit/_api.py b/keystonemiddleware/audit/_api.py
index ad50b4b..0d3361f 100644
--- a/keystonemiddleware/audit/_api.py
+++ b/keystonemiddleware/audit/_api.py
@@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-import ast
import collections
import logging
import re
+from oslo_serialization import jsonutils
from pycadf import cadftaxonomy as taxonomy
from pycadf import cadftype
from pycadf import credential
@@ -251,8 +251,7 @@ class OpenStackAuditApi(object):
catalog = {}
try:
- catalog = ast.literal_eval(
- req.environ['HTTP_X_SERVICE_CATALOG'])
+ catalog = jsonutils.loads(req.environ['HTTP_X_SERVICE_CATALOG'])
except KeyError:
msg = _LW('Unable to discover target information because '
'service catalog is missing. Either the incoming '