Skip to content

Change the name of the bucket to be in par with the changes on main repo #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nimbella/storage/plugins/aws_storage_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
12 changes: 6 additions & 6 deletions test/test_aws_storage_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down