Fix share force delete case
Manilaclient force delete sends two REST requests, first force delete and then delete. Fix it. Change-Id: I8257c04f2b5f1a02533dc0fa5d37ae6ff923a56a Closes-Bug: #2051737
This commit is contained in:
@@ -350,7 +350,7 @@ class DeleteShare(command.Command):
|
|||||||
|
|
||||||
if parsed_args.force:
|
if parsed_args.force:
|
||||||
share_client.shares.force_delete(share_obj)
|
share_client.shares.force_delete(share_obj)
|
||||||
if parsed_args.soft:
|
elif parsed_args.soft:
|
||||||
if share_client.api_version >= api_versions.APIVersion(
|
if share_client.api_version >= api_versions.APIVersion(
|
||||||
'2.69'):
|
'2.69'):
|
||||||
share_client.shares.soft_delete(share_obj)
|
share_client.shares.soft_delete(share_obj)
|
||||||
|
@@ -425,6 +425,8 @@ class TestShareDelete(TestShare):
|
|||||||
|
|
||||||
result = self.cmd.take_action(parsed_args)
|
result = self.cmd.take_action(parsed_args)
|
||||||
self.shares_mock.delete.assert_called_with(shares[0], None)
|
self.shares_mock.delete.assert_called_with(shares[0], None)
|
||||||
|
self.shares_mock.soft_delete.assert_not_called()
|
||||||
|
self.shares_mock.force_delete.assert_not_called()
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|
||||||
def test_share_delete_many(self):
|
def test_share_delete_many(self):
|
||||||
@@ -481,6 +483,8 @@ class TestShareDelete(TestShare):
|
|||||||
result = self.cmd.take_action(parsed_args)
|
result = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
self.shares_mock.force_delete.assert_called_once_with(shares[0])
|
self.shares_mock.force_delete.assert_called_once_with(shares[0])
|
||||||
|
self.shares_mock.delete.assert_not_called()
|
||||||
|
self.shares_mock.soft_delete.assert_not_called()
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|
||||||
def test_share_delete_with_soft(self):
|
def test_share_delete_with_soft(self):
|
||||||
@@ -500,6 +504,8 @@ class TestShareDelete(TestShare):
|
|||||||
result = self.cmd.take_action(parsed_args)
|
result = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
self.shares_mock.soft_delete.assert_called_once_with(shares[0])
|
self.shares_mock.soft_delete.assert_called_once_with(shares[0])
|
||||||
|
self.shares_mock.delete.assert_not_called()
|
||||||
|
self.shares_mock.force_delete.assert_not_called()
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|
||||||
def test_share_delete_wrong_name(self):
|
def test_share_delete_wrong_name(self):
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Share force delete command was sending two REST requests, first force delete and
|
||||||
|
then delete. Fixed it by removing delete request. For more details, please refer to
|
||||||
|
`launchpad bug 2051737 <https://bugs.launchpad.net/python-manilaclient/+bug/2051737>`_
|
Reference in New Issue
Block a user