diff --git a/nimbella/storage/plugins/aws_storage_plugin.py b/nimbella/storage/plugins/aws_storage_plugin.py index 306a5e8..734b40b 100644 --- a/nimbella/storage/plugins/aws_storage_plugin.py +++ b/nimbella/storage/plugins/aws_storage_plugin.py @@ -136,5 +136,5 @@ def getFiles(self, prefix = '') -> list: def bucket_key(self): datapart = "" if self.web else "data-" hostname = urlparse(self.apiHost).netloc - deployment = hostname.split(".")[0] - return f"{datapart}{self.namespace}-{deployment}-nimbella-io" + deployment = hostname.replace(".", "-") + return f"{datapart}{self.namespace}-{deployment}" diff --git a/test/test_aws_storage_plugin.py b/test/test_aws_storage_plugin.py index 596bf66..593ef90 100644 --- a/test/test_aws_storage_plugin.py +++ b/test/test_aws_storage_plugin.py @@ -30,30 +30,30 @@ def test_bucket_key_property(self): client = MagicMock() namespace = 'this-is-a-namespace' apiHost = 'https://this.is.a.host.com' - deployment = 'this' + deployment = 'this-is-a-host-com' # test bucket keys for web buckets web = True - aws = AWSStoragePlugin(client, namespace, apiHost, web, {}) - self.assertEqual(aws.bucket_key, f'{namespace}-{deployment}-nimbella-io') + aws = AWSStoragePlugin(client, namespace, apiHost, web, '') + self.assertEqual(aws.bucket_key, f'{namespace}-{deployment}') # test bucket keys for data buckets aws.web = False - self.assertEqual(aws.bucket_key, f'data-{namespace}-{deployment}-nimbella-io') + self.assertEqual(aws.bucket_key, f'data-{namespace}-{deployment}') def test_bucket_url(self): # test happy path using bucket location in creds client = MagicMock() namespace = 'this-is-a-namespace' apiHost = 'https://this.is.a.host.com' - deployment = 'this' + deployment = 'this-is-a-host-com' bucketHost = 'bucket.host.com' credentials = { "endpoint": f'https://{bucketHost}' } aws = AWSStoragePlugin(client, namespace, apiHost, True, credentials) - self.assertEqual(aws.url, f'http://{namespace}-{deployment}-nimbella-io.{bucketHost}') + self.assertEqual(aws.url, f'http://{namespace}-{deployment}.{bucketHost}') # Test bucket credentials contain weburl weburl = "http://some_other_address.com"