Added the Authorization header for MUSIC 81/64881/1
authorDileep Ranganathan <dileep.ranganathan@intel.com>
Wed, 5 Sep 2018 14:59:36 +0000 (07:59 -0700)
committerDileep Ranganathan <dileep.ranganathan@intel.com>
Wed, 5 Sep 2018 14:59:36 +0000 (07:59 -0700)
Fixed the Authorization header required for all MUSIC API.
This was affecting the HAS CSIT as the keyspace was not getting created

Change-Id: I1b22b9b71729e786f6ffb9baedf11d4475485e09
Issue-ID: OPTFRA-259
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
conductor/conductor/common/music/api.py

index b3bb5fc..2eeab3d 100644 (file)
 #
 
 """Music Data Store API"""
-
+import base64
 import copy
 import logging
 import time
 
-from oslo_config import cfg
-from oslo_log import log
-
 from conductor.common import rest
 from conductor.i18n import _LE, _LI  # pylint: disable=W0212
+from oslo_config import cfg
+from oslo_log import log
 
 LOG = log.getLogger(__name__)
 
@@ -130,13 +129,12 @@ class MusicAPI(object):
         self.rest = rest.REST(**kwargs)
 
         if(CONF.music_api.music_new_version):
-            MUSIC_version = CONF.music_api.music_version.split(".")
-
             self.rest.session.headers['content-type'] = 'application/json'
-            self.rest.session.headers['X-patchVersion'] = MUSIC_version[2]
             self.rest.session.headers['ns'] = CONF.music_api.aafns
-            self.rest.session.headers['userId'] = CONF.music_api.aafuser
-            self.rest.session.headers['password'] = CONF.music_api.aafpass
+            auth_str = 'Basic {}'.format(base64.encodestring(
+                '{}:{}'.format(CONF.music_api.aafuser,
+                               CONF.music_api.aafpass)).strip())
+            self.rest.session.headers['Authorization'] = auth_str
 
         self.lock_ids = {}