Merge pull request #2185 from coreos-inc/boto-port
Add support for custom ports on RADOS and S3 storage engines
This commit is contained in:
commit
ecfb6e03c2
3 changed files with 14 additions and 4 deletions
|
@ -280,6 +280,7 @@
|
||||||
<span class="config-string-field"
|
<span class="config-string-field"
|
||||||
binding="sc.data[1][field.name]"
|
binding="sc.data[1][field.name]"
|
||||||
placeholder="{{ field.placeholder }}"
|
placeholder="{{ field.placeholder }}"
|
||||||
|
pattern="{{ field.pattern }}"
|
||||||
ng-if="field.kind == 'text'"
|
ng-if="field.kind == 'text'"
|
||||||
is-optional="field.optional"></span>
|
is-optional="field.optional"></span>
|
||||||
<span class="config-bool-field"
|
<span class="config-bool-field"
|
||||||
|
|
|
@ -84,7 +84,8 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
||||||
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'},
|
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'},
|
||||||
{'name': 's3_access_key', 'title': 'AWS Access Key (optional if using IAM)', 'placeholder': 'accesskeyhere', 'kind': 'text', 'optional': true},
|
{'name': 's3_access_key', 'title': 'AWS Access Key (optional if using IAM)', 'placeholder': 'accesskeyhere', 'kind': 'text', 'optional': true},
|
||||||
{'name': 's3_secret_key', 'title': 'AWS Secret Key (optional if using IAM)', 'placeholder': 'secretkeyhere', 'kind': 'text', 'optional': true},
|
{'name': 's3_secret_key', 'title': 'AWS Secret Key (optional if using IAM)', 'placeholder': 'secretkeyhere', 'kind': 'text', 'optional': true},
|
||||||
{'name': 'host', 'title': 'S3 Host (optional)', 'placeholder': 's3.amazonaws.com', 'kind': 'text', 'optional': true}
|
{'name': 'host', 'title': 'S3 Host (optional)', 'placeholder': 's3.amazonaws.com', 'kind': 'text', 'optional': true},
|
||||||
|
{'name': 'port', 'title': 'S3 Port (optional)', 'placeholder': '443', 'kind': 'text', 'pattern': '^[0-9]+$', 'optional': true}
|
||||||
],
|
],
|
||||||
|
|
||||||
'GoogleCloudStorage': [
|
'GoogleCloudStorage': [
|
||||||
|
@ -96,6 +97,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
||||||
|
|
||||||
'RadosGWStorage': [
|
'RadosGWStorage': [
|
||||||
{'name': 'hostname', 'title': 'Rados Server Hostname', 'placeholder': 'my.rados.hostname', 'kind': 'text'},
|
{'name': 'hostname', 'title': 'Rados Server Hostname', 'placeholder': 'my.rados.hostname', 'kind': 'text'},
|
||||||
|
{'name': 'port', 'title': 'Custom Port (optional)', 'placeholder': '443', 'kind': 'text', 'pattern': '^[0-9]+$', 'optional': true},
|
||||||
{'name': 'is_secure', 'title': 'Is Secure', 'placeholder': 'Require SSL', 'kind': 'bool'},
|
{'name': 'is_secure', 'title': 'Is Secure', 'placeholder': 'Require SSL', 'kind': 'bool'},
|
||||||
{'name': 'access_key', 'title': 'Access Key', 'placeholder': 'accesskeyhere', 'kind': 'text', 'help_url': 'http://ceph.com/docs/master/radosgw/admin/'},
|
{'name': 'access_key', 'title': 'Access Key', 'placeholder': 'accesskeyhere', 'kind': 'text', 'help_url': 'http://ceph.com/docs/master/radosgw/admin/'},
|
||||||
{'name': 'secret_key', 'title': 'Secret Key', 'placeholder': 'secretkeyhere', 'kind': 'text'},
|
{'name': 'secret_key', 'title': 'Secret Key', 'placeholder': 'secretkeyhere', 'kind': 'text'},
|
||||||
|
@ -883,7 +885,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
||||||
scope: {
|
scope: {
|
||||||
'binding': '=binding',
|
'binding': '=binding',
|
||||||
'placeholder': '@placeholder',
|
'placeholder': '@placeholder',
|
||||||
'defaultValue': '@defaultValue'
|
'defaultValue': '@defaultValue',
|
||||||
},
|
},
|
||||||
controller: function($scope, $element) {
|
controller: function($scope, $element) {
|
||||||
$scope.bindinginternal = 0;
|
$scope.bindinginternal = 0;
|
||||||
|
|
|
@ -437,7 +437,7 @@ class _CloudStorage(BaseStorageV2):
|
||||||
|
|
||||||
class S3Storage(_CloudStorage):
|
class S3Storage(_CloudStorage):
|
||||||
def __init__(self, context, storage_path, s3_bucket, s3_access_key=None,
|
def __init__(self, context, storage_path, s3_bucket, s3_access_key=None,
|
||||||
s3_secret_key=None, host=None):
|
s3_secret_key=None, host=None, port=None):
|
||||||
upload_params = {
|
upload_params = {
|
||||||
'encrypt_key': True,
|
'encrypt_key': True,
|
||||||
}
|
}
|
||||||
|
@ -447,6 +447,10 @@ class S3Storage(_CloudStorage):
|
||||||
raise ValueError('host name must not start with http:// or https://')
|
raise ValueError('host name must not start with http:// or https://')
|
||||||
|
|
||||||
connect_kwargs['host'] = host
|
connect_kwargs['host'] = host
|
||||||
|
|
||||||
|
if port:
|
||||||
|
connect_kwargs['port'] = int(port)
|
||||||
|
|
||||||
super(S3Storage, self).__init__(context, boto.s3.connection.S3Connection, boto.s3.key.Key,
|
super(S3Storage, self).__init__(context, boto.s3.connection.S3Connection, boto.s3.key.Key,
|
||||||
connect_kwargs, upload_params, storage_path, s3_bucket,
|
connect_kwargs, upload_params, storage_path, s3_bucket,
|
||||||
access_key=s3_access_key or None,
|
access_key=s3_access_key or None,
|
||||||
|
@ -535,7 +539,7 @@ class GoogleCloudStorage(_CloudStorage):
|
||||||
|
|
||||||
class RadosGWStorage(_CloudStorage):
|
class RadosGWStorage(_CloudStorage):
|
||||||
def __init__(self, context, hostname, is_secure, storage_path, access_key, secret_key,
|
def __init__(self, context, hostname, is_secure, storage_path, access_key, secret_key,
|
||||||
bucket_name):
|
bucket_name, port=None):
|
||||||
upload_params = {}
|
upload_params = {}
|
||||||
connect_kwargs = {
|
connect_kwargs = {
|
||||||
'host': hostname,
|
'host': hostname,
|
||||||
|
@ -543,6 +547,9 @@ class RadosGWStorage(_CloudStorage):
|
||||||
'calling_format': boto.s3.connection.OrdinaryCallingFormat(),
|
'calling_format': boto.s3.connection.OrdinaryCallingFormat(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if port:
|
||||||
|
connect_kwargs['port'] = int(port)
|
||||||
|
|
||||||
super(RadosGWStorage, self).__init__(context, boto.s3.connection.S3Connection,
|
super(RadosGWStorage, self).__init__(context, boto.s3.connection.S3Connection,
|
||||||
boto.s3.key.Key, connect_kwargs, upload_params,
|
boto.s3.key.Key, connect_kwargs, upload_params,
|
||||||
storage_path, bucket_name, access_key, secret_key)
|
storage_path, bucket_name, access_key, secret_key)
|
||||||
|
|
Reference in a new issue