add ignore ssl

This commit is contained in:
wangyan 2017-07-31 17:29:19 +08:00
parent ebda8363f2
commit 77fa363992

View File

@ -2,7 +2,7 @@
import json import json
from optparse import OptionParser from optparse import OptionParser
import os import os
import urllib2 import urllib2, ssl
import sys import sys
import logging import logging
import logging.config import logging.config
@ -52,7 +52,7 @@ class Admiral:
request.add_header('Content-Length', data_len) request.add_header('Content-Length', data_len)
try: try:
urllib2.urlopen(request) urllib2.urlopen(request, context=ssl._create_unverified_context())
except Exception, e: except Exception, e:
if not retry: if not retry:
logger.error("failed to import project: %s, admiral_endpoint: %s, error: %s " % (project.project_name, self.admiral_url, str(e))) logger.error("failed to import project: %s, admiral_endpoint: %s, error: %s " % (project.project_name, self.admiral_url, str(e)))