-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Refactor account_url use in WasbHook #32980
Conversation
eba4b65
to
ec02d56
Compare
cc: @manmeetkaur |
This PR moves the account_url setting to one place. Tested this by making connection to azure using the different methods, however, I was not able to connect using the tenant_id in the extra field. This looks like a bug because ClientSecretCredential is not among the credentials to use in BlobServiceClient. The credentials to use include AzureNamedKeyCredential,AzureSasCredential,AsyncTokenCredential. So this will need special debugging.
ec02d56
to
78a02f3
Compare
78a02f3
to
0966636
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -184,15 +184,19 @@ def get_conn(self) -> BlobServiceClient: | |||
# connection_string auth takes priority | |||
return BlobServiceClient.from_connection_string(connection_string, **extra) | |||
|
|||
account_url = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That ended up still looking pretty gnarly, didn't it? 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but quite understandable
There are different ways users supply the hostname(account url) in azure, sometimes the host doesn't have a urlparse.scheme but has urlparse.path e.g name.blob.windows.net and other times, it will just be Azure ID e.g aldhjf9dads. While working on apache#32980, I assumed that if there's no scheme, then the hostname is not valid, that's incorrect since DNS can serve as the host. The fix was to check if we don't have netloc and that urlparse.path does not include a dot and if it does not, use the login/account_name to construct the account_url
* Fix updating account url for WasbHook There are different ways users supply the hostname(account url) in azure, sometimes the host doesn't have a urlparse.scheme but has urlparse.path e.g name.blob.windows.net and other times, it will just be Azure ID e.g aldhjf9dads. While working on #32980, I assumed that if there's no scheme, then the hostname is not valid, that's incorrect since DNS can serve as the host. The fix was to check if we don't have netloc and that urlparse.path does not include a dot and if it does not, use the login/account_name to construct the account_url * fixup! Fix updating account url for WasbHook
This PR moves the account_url setting to one place.
Tested this by making connection to azure using the different methods, however, I was not able to connect using
the tenant_id in the extra field. This looks like a bug because ClientSecretCredential is not among the credentials
to use in BlobServiceClient. The credentials to use include AzureNamedKeyCredential,AzureSasCredential,AsyncTokenCredential.
So this will need special debugging.