From 614f412a3b9ce3057c7d0dc5e867e5edcd282bd1 Mon Sep 17 00:00:00 2001 From: Tejus Bharadwaj Date: Tue, 20 Jul 2021 14:26:58 +0530 Subject: [PATCH] Change the name of the bucket to be in par with the changes on main repo --- nimbella/storage/plugins/aws_storage_plugin.py | 4 ++-- test/test_aws_storage_plugin.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nimbella/storage/plugins/aws_storage_plugin.py b/nimbella/storage/plugins/aws_storage_plugin.py index 32aabe0..6d77731 100644 --- a/nimbella/storage/plugins/aws_storage_plugin.py +++ b/nimbella/storage/plugins/aws_storage_plugin.py @@ -129,5 +129,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 0d4010c..a8b61b0 100644 --- a/test/test_aws_storage_plugin.py +++ b/test/test_aws_storage_plugin.py @@ -21,30 +21,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') + 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"