Merge "Use jsonutils instead of ast for loading the service catalog"

This commit is contained in:
Jenkins 2016-07-18 12:47:32 +00:00 committed by Gerrit Code Review
commit f2be5181ab
3 changed files with 12 additions and 13 deletions

View File

@ -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 '

View File

@ -82,8 +82,8 @@ class BaseAuditMiddlewareTest(utils.BaseTestCase):
"internalURL":
"http://internal_host:8774",
"id": "resource_id"}],
"type": "compute",
"name": "nova"},]''',
"type": "compute",
"name": "nova"}]''',
'HTTP_X_USER_ID': 'user_id',
'HTTP_X_USER_NAME': 'user_name',
'HTTP_X_AUTH_TOKEN': 'token',

View File

@ -225,8 +225,8 @@ class AuditApiLogicTest(base.BaseAuditMiddlewareTest):
"http://public_host:8774",
"internalURL":
"http://internal_host:8774"}],
"type": "compute",
"name": "nova"},]''',
"type": "compute",
"name": "nova"}]''',
'HTTP_X_USER_ID': 'user_id',
'HTTP_X_USER_NAME': 'user_name',
'HTTP_X_AUTH_TOKEN': 'token',
@ -246,8 +246,8 @@ class AuditApiLogicTest(base.BaseAuditMiddlewareTest):
"region": "RegionOne",
"publicURL":
"http://public_host:8774"}],
"type": "compute",
"name": "nova"},]''',
"type": "compute",
"name": "nova"}]''',
'HTTP_X_USER_ID': 'user_id',
'HTTP_X_USER_NAME': 'user_name',
'HTTP_X_AUTH_TOKEN': 'token',
@ -267,8 +267,8 @@ class AuditApiLogicTest(base.BaseAuditMiddlewareTest):
"region": "RegionOne",
"internalURL":
"http://internal_host:8774"}],
"type": "compute",
"name": "nova"},]''',
"type": "compute",
"name": "nova"}]''',
'HTTP_X_USER_ID': 'user_id',
'HTTP_X_USER_NAME': 'user_name',
'HTTP_X_AUTH_TOKEN': 'token',
@ -288,8 +288,8 @@ class AuditApiLogicTest(base.BaseAuditMiddlewareTest):
"http://public_host:8774",
"internalURL":
"http://internal_host:8774"}],
"type": "compute",
"name": "nova"},]''',
"type": "compute",
"name": "nova"}]''',
'HTTP_X_USER_ID': 'user_id',
'HTTP_X_USER_NAME': 'user_name',
'HTTP_X_AUTH_TOKEN': 'token',