Skip to content

Commit

Permalink
ceph: fix to support TLS enabled rgw-endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
  • Loading branch information
aruniiird committed Sep 11, 2020
1 parent 6998d00 commit 3de87cc
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,18 @@ def _invalid_endpoint(self, endpoint_str):
"Out of range port number: {}".format(port))
return False

def endpoint_dial(self, endpoint_str):
try:
ep = "http://" + endpoint_str
r = requests.head(ep)
rc = r.status_code
if rc != 200:
raise ExecutionFailureException(
"wrong return code {} on rgw endpoint http header request".format(rc))
except requests.ConnectionError:
raise ExecutionFailureException(
"failed to connect to rgw endpoint {}".format(ep))
def endpoint_dial(self, endpoint_str, timeout=3):
protocols = ["http", "https"]
for prefix in protocols:
try:
ep = "{}://{}".format(prefix, endpoint_str)
r = requests.head(ep, timeout=timeout)
if r.status_code == 200:
return
except:
continue
raise ExecutionFailureException(
"unable to connect to endpoint: {}".format(endpoint_str))

def __init__(self, arg_list=None):
self.out_map = {}
Expand Down

0 comments on commit 3de87cc

Please sign in to comment.