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

Deprecated new_name in Undelete #18690

Merged
merged 4 commits into from
Jul 7, 2021

Conversation

tasherif-msft
Copy link
Contributor

new_name is no longer supported on the service side for undelete_container() and undelete_filesystem()

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label May 13, 2021
Copy link

@amishra-dev amishra-dev left a comment

Choose a reason for hiding this comment

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

Can we update the API comments to indicate that the parameter does not work if the value is different than the original container?

@tasherif-msft
Copy link
Contributor Author

Can we update the API comments to indicate that the parameter does not work if the value is different than the original container?

So we want to keep the parameter even though the only applicable value is if it matches the old one?
In this PR I just removed the parameter altogether and surfaced a deprecation warning if the user passes it - then we let service throw.

@amishra-dev
Copy link

Can we update the API comments to indicate that the parameter does not work if the value is different than the original container?

So we want to keep the parameter even though the only applicable value is if it matches the old one?
In this PR I just removed the parameter altogether and surfaced a deprecation warning if the user passes it - then we let service throw.

isnt' that a breaking change?

@tasherif-msft
Copy link
Contributor Author

tasherif-msft commented May 13, 2021

Can we update the API comments to indicate that the parameter does not work if the value is different than the original container?

So we want to keep the parameter even though the only applicable value is if it matches the old one?
In this PR I just removed the parameter altogether and surfaced a deprecation warning if the user passes it - then we let service throw.

isnt' that a breaking change?

Well technically in Python they can still pass it if they want to (since it was a kwarg not a regular argument) and currently we ARE parsing it like we did before - its just now we surface a warning (if the cx passes it) and let service throw accordingly. However since this kwarg is no longer supported thought it would be best to get removed from the docstrings as an accepted kwarg. Do you feel like it should be kept in the docstrings as an accepted kwarg and add a deprecation comment besides it? (we don't believe that's necessary)

:keyword int timeout:
The timeout parameter is expressed in seconds.
:rtype: ~azure.storage.blob.aio.ContainerClient
"""
new_name = kwargs.pop('new_name', None)
if new_name:
warnings.simplefilter('always', DeprecationWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Anna! I think we should let the user to choose how they want to deal with the warning, what do you think? @annatisch

@xiafu-msft xiafu-msft enabled auto-merge (squash) May 14, 2021 02:00
@tasherif-msft tasherif-msft requested a review from amishra-dev May 15, 2021 22:47
Comment on lines -253 to -281
async def test_restore_to_existing_file_system(self, datalake_storage_account_name, datalake_storage_account_key):
# Needs soft delete enabled account.
if not self.is_playback():
return
self._setUp(datalake_storage_account_name, datalake_storage_account_key)
# get an existing filesystem
existing_name = self._get_file_system_reference(prefix="existing")
name = self._get_file_system_reference(prefix="filesystem")
existing_filesystem_client = await self.dsc.create_file_system(existing_name)
filesystem_client = await self.dsc.create_file_system(name)

# Act
await filesystem_client.delete_file_system()
# to make sure the filesystem deleted
with self.assertRaises(ResourceNotFoundError):
await filesystem_client.get_file_system_properties()

filesystem_list = []
async for fs in self.dsc.list_file_systems(include_deleted=True):
filesystem_list.append(fs)
self.assertTrue(len(filesystem_list) >= 1)

for filesystem in filesystem_list:
# find the deleted filesystem and restore it
if filesystem.deleted and filesystem.name == filesystem_client.file_system_name:
with self.assertRaises(HttpResponseError):
await self.dsc.undelete_file_system(filesystem.name, filesystem.deleted_version,
new_name=existing_filesystem_client.file_system_name)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we still need to test restoring to existing filesystem/container, while it can be added later and tracked in an issue
the steps are

  1. use soft delete enabled account
  2. create container A and soft delete it
  3. recreate container A
  4. restore deleted container and see if we can get HttpResponseError

@tasherif-msft tasherif-msft disabled auto-merge July 7, 2021 21:33
@tasherif-msft tasherif-msft dismissed amishra-dev’s stale review July 7, 2021 21:34

This has been done

@tasherif-msft tasherif-msft merged commit 1fadc7e into Azure:main Jul 7, 2021
rakshith91 pushed a commit to rakshith91/azure-sdk-for-python that referenced this pull request Jul 16, 2021
* Deprecated new_name in Undelete

* added additional TODO comments on soft delete enabled tests

* removed it from DSC

* removed line
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this pull request Apr 28, 2022
Add new enum values to DataBindingMode (Azure#18690)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants