From cff7e39339cc8735e3dc930bd1ce6761d502e307 Mon Sep 17 00:00:00 2001 From: Girish Shilamkar Date: Mon, 11 Nov 2013 15:10:29 +0530 Subject: [PATCH] Fixed few hunks which were incorrect. While adding certain marvin related fixes from master to 4.2 branch incorrect hunks were added. Fixed them. --- tools/marvin/marvin/cloudstackConnection.py | 27 ++++++--------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 64a43f8a4cd..644cf3a091e 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -32,6 +32,7 @@ from requests import RequestException class cloudConnection(object): + """ Connections to make API calls to the cloudstack management server """ def __init__(self, mgmtDet, asyncTimeout=3600, logging=None, @@ -56,7 +57,7 @@ class cloudConnection(object): (self.apiKey is None and self.securityKey is None): self.auth = False if mgmtDet.useHttps == "True": - self.protocol = "https" + self.protocol = "https" self.baseurl = "%s://%s:%d/%s"\ % (self.protocol, self.mgtSvr, self.port, self.path) @@ -157,12 +158,12 @@ class cloudConnection(object): #Verify whether protocol is "http", then call the request over http if self.protocol == "http": - if method == 'POST': - response = requests.post(self.baseurl, params=payload, + if method == 'POST': + response = requests.post(self.baseurl, params=payload, + verify=https_flag) + else: + response = requests.get(self.baseurl, params=payload, verify=https_flag) - else: - response = requests.get(self.baseurl, params=payload, - verify=https_flag) else: ''' If protocol is https, then create the connection url with \ @@ -170,20 +171,6 @@ class cloudConnection(object): provided as part of cert ''' try: - if method == 'POST': - response = requests.post(self.baseurl, params=payload, - cert=cert_path, verify=https_flag) - else: - response = requests.get(self.baseurl, params=payload, - cert=cert_path, verify=https_flag) - except Exception,e: - ''' - If an exception occurs with current CA certs,\ - then try with default certs path, we dont need \ - to mention here the cert path - ''' - self.logging.debug( "Creating CS connection over https \ - didnt worked with user provided certs %s"%e ) if method == 'POST': response = requests.post(self.baseurl, params=payload,