mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
qa: import py3 compatible modules using six
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
947a74349d
commit
80b71ef461
@ -4,8 +4,8 @@ Deploy and configure Barbican for Teuthology
|
||||
import argparse
|
||||
import contextlib
|
||||
import logging
|
||||
import httplib
|
||||
from urlparse import urlparse
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib.parse import urlparse
|
||||
import json
|
||||
|
||||
from teuthology import misc as teuthology
|
||||
@ -250,7 +250,7 @@ def create_secrets(ctx, config):
|
||||
port=barbican_port)
|
||||
log.info("barbican_url=%s", barbican_url)
|
||||
#fetching user_id of user that gets secrets for radosgw
|
||||
token_req = httplib.HTTPConnection(keystone_host, keystone_port, timeout=30)
|
||||
token_req = http_client.HTTPConnection(keystone_host, keystone_port, timeout=30)
|
||||
token_req.request(
|
||||
'POST',
|
||||
'/v2.0/tokens',
|
||||
@ -287,7 +287,7 @@ def create_secrets(ctx, config):
|
||||
if 'password' not in secret:
|
||||
raise ConfigError('barbican.secrets must have "password" field')
|
||||
|
||||
token_req = httplib.HTTPConnection(keystone_host, keystone_port, timeout=30)
|
||||
token_req = http_client.HTTPConnection(keystone_host, keystone_port, timeout=30)
|
||||
token_req.request(
|
||||
'POST',
|
||||
'/v2.0/tokens',
|
||||
@ -324,7 +324,7 @@ def create_secrets(ctx, config):
|
||||
"payload_content_encoding": "base64"
|
||||
})
|
||||
|
||||
sec_req = httplib.HTTPConnection(barbican_host, barbican_port, timeout=30)
|
||||
sec_req = http_client.HTTPConnection(barbican_host, barbican_port, timeout=30)
|
||||
try:
|
||||
sec_req.request(
|
||||
'POST',
|
||||
@ -355,7 +355,7 @@ def create_secrets(ctx, config):
|
||||
"project-access": True
|
||||
}
|
||||
})
|
||||
acl_req = httplib.HTTPConnection(secret_url_parsed.netloc, timeout=30)
|
||||
acl_req = http_client.HTTPConnection(secret_url_parsed.netloc, timeout=30)
|
||||
acl_req.request(
|
||||
'PUT',
|
||||
secret_url_parsed.path+'/acl',
|
||||
|
@ -14,7 +14,7 @@ import json
|
||||
import logging
|
||||
import time
|
||||
import datetime
|
||||
import Queue
|
||||
from six.moves import queue
|
||||
|
||||
import sys
|
||||
import six
|
||||
|
@ -1,4 +1,8 @@
|
||||
from mock import Mock
|
||||
import six
|
||||
if six.PY3:
|
||||
from unittest.mock import Mock
|
||||
else:
|
||||
from mock import Mock
|
||||
|
||||
from tasks import radosgw_admin
|
||||
|
||||
|
@ -6,10 +6,10 @@ import argparse
|
||||
import contextlib
|
||||
import logging
|
||||
import time
|
||||
import httplib
|
||||
import json
|
||||
from os import path
|
||||
from urlparse import urljoin
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib.parse import urljoin
|
||||
|
||||
from teuthology import misc as teuthology
|
||||
from teuthology import contextutil
|
||||
@ -155,7 +155,7 @@ def setup_vault(ctx, config):
|
||||
|
||||
def send_req(ctx, cconfig, client, path, body, method='POST'):
|
||||
host, port = ctx.vault.endpoints[client]
|
||||
req = httplib.HTTPConnection(host, port, timeout=30)
|
||||
req = http_client.HTTPConnection(host, port, timeout=30)
|
||||
token = cconfig.get('root_token', 'atoken')
|
||||
log.info("Send request to Vault: %s:%s at %s with token: %s", host, port, path, token)
|
||||
headers = {'X-Vault-Token': token}
|
||||
|
@ -53,7 +53,7 @@ from ConfigParser import SafeConfigParser, NoSectionError
|
||||
from flask import abort, Flask, request, Response
|
||||
from hashlib import sha1 as sha
|
||||
from time import gmtime, strftime
|
||||
from urlparse import urlparse
|
||||
from six.moves.urllib.parse import urlparse
|
||||
import argparse
|
||||
import base64
|
||||
import hmac
|
||||
|
@ -1,8 +1,7 @@
|
||||
import logging
|
||||
import json
|
||||
import tempfile
|
||||
import BaseHTTPServer
|
||||
import SocketServer
|
||||
from six.moves import BaseHTTPServer
|
||||
import random
|
||||
import threading
|
||||
import subprocess
|
||||
|
@ -1,12 +1,12 @@
|
||||
import logging
|
||||
import httplib
|
||||
import ssl
|
||||
import urllib
|
||||
import urlparse
|
||||
import hmac
|
||||
import hashlib
|
||||
import base64
|
||||
import xmltodict
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from time import gmtime, strftime
|
||||
from tasks.rgw_multi.multisite import Zone
|
||||
import boto3
|
||||
@ -88,7 +88,7 @@ def make_request(conn, method, resource, parameters=None, sign_parameters=False,
|
||||
headers = {'Authorization': 'AWS '+conn.aws_access_key_id+':'+signature,
|
||||
'Date': string_date,
|
||||
'Host': conn.host+':'+str(conn.port)}
|
||||
http_conn = httplib.HTTPConnection(conn.host, conn.port)
|
||||
http_conn = http_client.HTTPConnection(conn.host, conn.port)
|
||||
if log.getEffectiveLevel() <= 10:
|
||||
http_conn.set_debuglevel(5)
|
||||
http_conn.request(method, resource+url_params, NO_HTTP_BODY, headers)
|
||||
@ -227,10 +227,10 @@ class PSTopicS3:
|
||||
'Host': self.conn.host+':'+str(self.conn.port),
|
||||
'Content-Type': content_type}
|
||||
if self.conn.is_secure:
|
||||
http_conn = httplib.HTTPSConnection(self.conn.host, self.conn.port,
|
||||
http_conn = http_client.HTTPSConnection(self.conn.host, self.conn.port,
|
||||
context=ssl.create_default_context(cafile='./cert.pem'))
|
||||
else:
|
||||
http_conn = httplib.HTTPConnection(self.conn.host, self.conn.port)
|
||||
http_conn = http_client.HTTPConnection(self.conn.host, self.conn.port)
|
||||
http_conn.request(method, resource, body, headers)
|
||||
response = http_conn.getresponse()
|
||||
data = response.read()
|
||||
@ -269,10 +269,10 @@ class PSTopicS3:
|
||||
'Host': self.conn.host+':'+str(self.conn.port),
|
||||
'Content-Type': content_type}
|
||||
if self.conn.is_secure:
|
||||
http_conn = httplib.HTTPSConnection(self.conn.host, self.conn.port,
|
||||
http_conn = http_client.HTTPSConnection(self.conn.host, self.conn.port,
|
||||
context=ssl.create_default_context(cafile='./cert.pem'))
|
||||
else:
|
||||
http_conn = httplib.HTTPConnection(self.conn.host, self.conn.port)
|
||||
http_conn = http_client.HTTPConnection(self.conn.host, self.conn.port)
|
||||
http_conn.request(method, resource, body, headers)
|
||||
response = http_conn.getresponse()
|
||||
data = response.read()
|
||||
|
Loading…
Reference in New Issue
Block a user