Skip to content

Commit

Permalink
[Storage] [Hotfix] Fix breaking change in create_configuration and …
Browse files Browse the repository at this point in the history
…prepare patches (#32071)
  • Loading branch information
jalauzon-msft authored Sep 13, 2023
1 parent 7ce49c9 commit 80e2aa4
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 10 deletions.
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"

0 comments on commit 80e2aa4

Please sign in to comment.