From c477064f0b4d30ff9f8a467dd8fa6564203956fb Mon Sep 17 00:00:00 2001 From: Dileep Ranganathan Date: Fri, 28 Sep 2018 02:56:29 -0700 Subject: Fix AAF Authentication CSIT issues The value stored in perms.cache is throwing JSON load error on subsequent calls. Returned the perms['roles'] from cache. Fixed expected string or buffer error in plans.py CSIT was stuck waiting for port 8100. Changed the aafsim internal port to 8100 everywhere (same as the aaf-service port). Change-Id: I00e72a0aee66bb0649996288c37c6c0aef2070d2 Issue-ID: OPTFRA-362 Signed-off-by: Dileep Ranganathan --- conductor/conductor/api/adapters/aaf/aaf_authentication.py | 2 +- conductor/conductor/api/controllers/v1/plans.py | 4 ++-- conductor/conductor/tests/functional/simulators/aafsim/Dockerfile | 5 +++-- conductor/conductor/tests/functional/simulators/run_aafsim.sh | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'conductor') diff --git a/conductor/conductor/api/adapters/aaf/aaf_authentication.py b/conductor/conductor/api/adapters/aaf/aaf_authentication.py index fca84fd..e6b79d2 100644 --- a/conductor/conductor/api/adapters/aaf/aaf_authentication.py +++ b/conductor/conductor/api/adapters/aaf/aaf_authentication.py @@ -113,7 +113,7 @@ def get_aaf_permissions(uid, passwd): if perms and datetime.now() < perms.get(EXPIRE_TIME): LOG.debug("Returning cached value") - return perms + return perms['roles'] LOG.debug("Invoking AAF authentication API") response = remote_api(passwd, uid) perms = {EXPIRE_TIME: datetime.now() + time_delta, 'roles': response} diff --git a/conductor/conductor/api/controllers/v1/plans.py b/conductor/conductor/api/controllers/v1/plans.py index f70b998..b32caef 100644 --- a/conductor/conductor/api/controllers/v1/plans.py +++ b/conductor/conductor/api/controllers/v1/plans.py @@ -350,8 +350,8 @@ def verify_user(authstr): user_pw = auth_str.split(' ')[1] decode_user_pw = base64.b64decode(user_pw) list_id_pw = decode_user_pw.split(':') - user_dict['username'] = list_id_pw[0] - user_dict['password'] = list_id_pw[1] + user_dict['username'] = str(list_id_pw[0]) + user_dict['password'] = str(list_id_pw[1]) password = CONF.conductor_api.password username = CONF.conductor_api.username diff --git a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile index 5970b3b..eb43a86 100755 --- a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile +++ b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile @@ -27,13 +27,14 @@ ADD ./ /opt/aafsim # Install any needed packages specified in requirements.txt RUN pip install web.py +RUN pip install oslo.log # Make port 80 available to the world outside this container -EXPOSE 8081 +EXPOSE 8100 # Define environment variable ENV NAME aafsim # Run aafsim.py when the container launches -CMD ["/bin/sh", "-c", "python -u aafsim.py 8081 > /tmp/aafsim.log 2>&1"] +CMD ["/bin/sh", "-c", "python -u aafsim.py 8100 > /tmp/aafsim.log 2>&1"] diff --git a/conductor/conductor/tests/functional/simulators/run_aafsim.sh b/conductor/conductor/tests/functional/simulators/run_aafsim.sh index 0039bbc..8535613 100755 --- a/conductor/conductor/tests/functional/simulators/run_aafsim.sh +++ b/conductor/conductor/tests/functional/simulators/run_aafsim.sh @@ -17,6 +17,6 @@ # # ------------------------------------------------------------------------- # -# Note mapping to external port 8082. avoids conflict with aaisim -docker run -d --name aafsim -p 8082:8081 aafsim +# Note mapping to external port 8100. avoids conflict with aaisim +docker run -d --name aafsim -p 8100:8100 aafsim -- cgit 1.2.3-korg