boto3: _get_post_url() uses config endpoint

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2019-02-26 16:25:28 -05:00
parent ac18365f75
commit 7f49adda30
2 changed files with 6 additions and 12 deletions

View file

@ -339,6 +339,9 @@ def get_config_host():
def get_config_port(): def get_config_port():
return config.default_port return config.default_port
def get_config_endpoint():
return config.default_endpoint
def get_main_aws_access_key(): def get_main_aws_access_key():
return config.main_access_key return config.main_access_key

View file

@ -50,6 +50,7 @@ from . import (
get_config_is_secure, get_config_is_secure,
get_config_host, get_config_host,
get_config_port, get_config_port,
get_config_endpoint,
get_main_aws_access_key, get_main_aws_access_key,
get_main_aws_secret_key, get_main_aws_secret_key,
get_main_display_name, get_main_display_name,
@ -1360,18 +1361,8 @@ def test_object_write_file():
eq(body, 'bar') eq(body, 'bar')
def _get_post_url(bucket_name): def _get_post_url(bucket_name):
protocol='http' endpoint = get_config_endpoint()
is_secure = get_config_is_secure() return '{endpoint}/{bucket_name}'.format(endpoint=endpoint, bucket_name=bucket_name)
if is_secure is True:
protocol='https'
host = get_config_host()
port = get_config_port()
url = '{protocol}://{host}:{port}/{bucket_name}'.format(protocol=protocol,\
host=host, port=port, bucket_name=bucket_name)
return url
@attr(resource='object') @attr(resource='object')
@attr(method='post') @attr(method='post')