Repository: stratos
Updated Branches:
  refs/heads/master 4991fa18a -> 54fc2e13d


Applying patch done by udara for metadata api client get method


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/54fc2e13
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/54fc2e13
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/54fc2e13

Branch: refs/heads/master
Commit: 54fc2e13d086ead27d559463006577f3699a739a
Parents: 4991fa1
Author: Imesh Gunaratne <[email protected]>
Authored: Sun May 31 12:24:52 2015 +0100
Committer: Imesh Gunaratne <[email protected]>
Committed: Sun May 31 12:24:52 2015 +0100

----------------------------------------------------------------------
 .../cartridge.agent/cartridge.agent/mdsclient.py       | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/54fc2e13/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/mdsclient.py
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/mdsclient.py
 
b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/mdsclient.py
index afa7e9c..b818deb 100644
--- 
a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/mdsclient.py
+++ 
b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/mdsclient.py
@@ -73,13 +73,18 @@ def get(app=False):
     try:
         if app:
             log.debug("Retrieving metadata from the Metadata service. [URL] 
%s" % app_resource_url)
-            req_response = urllib2.urlopen(app_resource_url)
+           request = urllib2.Request(app_resource_url)
         else:
             log.debug("Retrieving metadata from the Metadata service. [URL] 
%s" % alias_resource_url)
-            req_response = urllib2.urlopen(alias_resource_url)
+           request = urllib2.Request(alias_resource_url)
+
+           request.add_header("Authorization", "Bearer %s" % token)
+           request.add_header('Content-Type', 'application/json')
+
+           response = urllib2.urlopen(request).read()
+           get_response = json.loads(response)
+           properties = get_response["properties"]
 
-        get_response = json.loads(req_response.read())
-        properties = get_response["properties"]
         log.debug("Retrieved values from Metadata service: %s" % properties)
         response_obj = MDSResponse()
 

Reply via email to