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

[Storage] [Hotfix] Fix breaking change in create_configuration and prepare patches #32071

Merged
merged 3 commits into from
Sep 13, 2023
Merged
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
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 12.18.1 (2023-09-13)

### Bugs Fixed
- Fixed breaking `KeyError: 'sdk_moniker'` in `create_configuration`.
NOTE: This is not an exported method and therefore should not be imported/called directly.

## 12.18.0 (2023-09-12)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ def parse_connection_str(conn_str, credential, service):

def create_configuration(**kwargs):
# type: (**Any) -> Configuration
# Backwards compatibility if someone is not passing sdk_moniker
if not kwargs.get("sdk_moniker"):
kwargs["sdk_moniker"] = f"storage-{kwargs.pop('storage_sdk')}/{VERSION}"
config = Configuration(**kwargs)
config.headers_policy = StorageHeadersPolicy(**kwargs)
config.user_agent_policy = UserAgentPolicy(sdk_moniker=kwargs.pop('sdk_moniker'), **kwargs)
config.user_agent_policy = UserAgentPolicy(**kwargs)
config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs)
config.logging_policy = StorageLoggingPolicy(**kwargs)
config.proxy_policy = ProxyPolicy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.18.0"
VERSION = "12.18.1"
15 changes: 14 additions & 1 deletion sdk/storage/azure-storage-blob/tests/test_blob_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import pytest
from azure.core.credentials import AzureSasCredential
from azure.core.exceptions import AzureError
from azure.storage.blob import (
AccountSasPermissions,
BlobClient,
Expand All @@ -19,6 +18,7 @@
ResourceTypes,
VERSION,
)
from azure.storage.blob._shared.base_client import create_configuration

from devtools_testutils import recorded_by_proxy
from devtools_testutils.storage import StorageRecordedTestCase
Expand Down Expand Up @@ -718,4 +718,17 @@ def test_closing_pipeline_client_simple(self, **kwargs):
self.account_url(storage_account_name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar')
service.close()

@BlobPreparer()
def test_create_configuration_legacy(self, **kwargs):
# Arrange
sdk_name = 'Blob-test'

# Act
config = create_configuration(storage_sdk=sdk_name)

# Assert
assert config is not None
assert config.max_block_size == 4 * 1024 * 1024
assert sdk_name in config.user_agent_policy.user_agent

# ------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-file-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 12.13.1 (2023-09-13)

### Bugs Fixed
- Fixed breaking `KeyError: 'sdk_moniker'` in `create_configuration`.
NOTE: This is not an exported method and therefore should not be imported/called directly.

## 12.13.0 (2023-09-12)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ def parse_connection_str(conn_str, credential, service):

def create_configuration(**kwargs):
# type: (**Any) -> Configuration
# Backwards compatibility if someone is not passing sdk_moniker
if not kwargs.get("sdk_moniker"):
kwargs["sdk_moniker"] = f"storage-{kwargs.pop('storage_sdk')}/{VERSION}"
config = Configuration(**kwargs)
config.headers_policy = StorageHeadersPolicy(**kwargs)
config.user_agent_policy = UserAgentPolicy(sdk_moniker=kwargs.pop('sdk_moniker'), **kwargs)
config.user_agent_policy = UserAgentPolicy(**kwargs)
config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs)
config.logging_policy = StorageLoggingPolicy(**kwargs)
config.proxy_policy = ProxyPolicy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.13.0"
VERSION = "12.13.1"
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file-datalake/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
python_requires=">=3.7",
install_requires=[
"azure-core<2.0.0,>=1.28.0",
"azure-storage-blob<13.0.0,>=12.18.0",
"azure-storage-blob<13.0.0,>=12.18.1",
"typing-extensions>=4.3.0",
"isodate>=0.6.1"
],
Expand Down
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-file-share/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 12.14.1 (2023-09-13)

### Bugs Fixed
- Fixed breaking `KeyError: 'sdk_moniker'` in `create_configuration`.
NOTE: This is not an exported method and therefore should not be imported/called directly.

## 12.14.0 (2023-09-12)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ def parse_connection_str(conn_str, credential, service):

def create_configuration(**kwargs):
# type: (**Any) -> Configuration
# Backwards compatibility if someone is not passing sdk_moniker
if not kwargs.get("sdk_moniker"):
kwargs["sdk_moniker"] = f"storage-{kwargs.pop('storage_sdk')}/{VERSION}"
config = Configuration(**kwargs)
config.headers_policy = StorageHeadersPolicy(**kwargs)
config.user_agent_policy = UserAgentPolicy(sdk_moniker=kwargs.pop('sdk_moniker'), **kwargs)
config.user_agent_policy = UserAgentPolicy(**kwargs)
config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs)
config.logging_policy = StorageLoggingPolicy(**kwargs)
config.proxy_policy = ProxyPolicy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.14.0"
VERSION = "12.14.1"
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-queue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 12.7.1 (2023-09-13)

### Bugs Fixed
- Fixed breaking `KeyError: 'sdk_moniker'` in `create_configuration`.
NOTE: This is not an exported method and therefore should not be imported/called directly.

## 12.7.0 (2023-09-12)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ def parse_connection_str(conn_str, credential, service):

def create_configuration(**kwargs):
# type: (**Any) -> Configuration
# Backwards compatibility if someone is not passing sdk_moniker
if not kwargs.get("sdk_moniker"):
kwargs["sdk_moniker"] = f"storage-{kwargs.pop('storage_sdk')}/{VERSION}"
config = Configuration(**kwargs)
config.headers_policy = StorageHeadersPolicy(**kwargs)
config.user_agent_policy = UserAgentPolicy(sdk_moniker=kwargs.pop('sdk_moniker'), **kwargs)
config.user_agent_policy = UserAgentPolicy(**kwargs)
config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs)
config.logging_policy = StorageLoggingPolicy(**kwargs)
config.proxy_policy = ProxyPolicy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.7.0"
VERSION = "12.7.1"