Skip to content
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

make_bucket: use region passed via constructor #1103

Merged
merged 1 commit into from
Mar 29, 2021

Conversation

balamurugana
Copy link
Member

Fixes #1102

@@ -619,7 +619,7 @@ def make_bucket(self, bucket_name, location=None, object_lock=False):
self._base_url.region, location,
),
)
location = location or "us-east-1"
location = self._base_url.region or location or "us-east-1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location = self._base_url.region or location or "us-east-1"
location = location or self._base_url.region or "us-east-1"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be this, as the user is explicitly specifying the location they want to use, even if the region is set in the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It is not allowed. It will make confusion in other APIs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a general comment.
Wouldn't it be better to define a constant for the default region instead of hard coding it in several different places (5) in the code?

_DEFAULT_REGION = "us-east-1"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is out of scope of this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, if region is specified in the constructor, and also specified in the make_bucket call and they are different, do we reject it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@kannappanr kannappanr requested a review from ebozduman March 27, 2021 23:45
@@ -619,7 +619,7 @@ def make_bucket(self, bucket_name, location=None, object_lock=False):
self._base_url.region, location,
),
)
location = location or "us-east-1"
location = self._base_url.region or location or "us-east-1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a general comment.
Wouldn't it be better to define a constant for the default region instead of hard coding it in several different places (5) in the code?

_DEFAULT_REGION = "us-east-1"

Copy link
Collaborator

@ebozduman ebozduman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kannappanr kannappanr merged commit fe78f92 into minio:master Mar 29, 2021
@balamurugana balamurugana deleted the fix-issue-1102 branch April 1, 2021 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make_bucket should use base_url's region as location if configured
3 participants