Skip to content

Commit b6b1848

Browse files
committed
Fix volume backup show by name
When we show a volume backup by name, it calls the get_backup method in SDK which is only used for getting a backup by ID. This patch modifies the approach to call find_backup method which first tries the find by ID and then find by name logic eventually returning the backup details. Story: 2011234 Task: 51127 Change-Id: I926d8de9810fcf2e5335bbe35aaab15e1e36a5cb
1 parent 8979c00 commit b6b1848

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

openstackclient/tests/unit/volume/v2/test_volume_backup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class TestBackupShow(volume_fakes.TestVolume):
544544
def setUp(self):
545545
super().setUp()
546546

547-
self.volume_sdk_client.get_backup.return_value = self.backup
547+
self.volume_sdk_client.find_backup.return_value = self.backup
548548
# Get the command object to test
549549
self.cmd = volume_backup.ShowVolumeBackup(self.app, None)
550550

@@ -554,7 +554,7 @@ def test_backup_show(self):
554554
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
555555

556556
columns, data = self.cmd.take_action(parsed_args)
557-
self.volume_sdk_client.get_backup.assert_called_with(self.backup.id)
557+
self.volume_sdk_client.find_backup.assert_called_with(self.backup.id)
558558

559559
self.assertEqual(self.columns, columns)
560560
self.assertEqual(self.data, data)

openstackclient/tests/unit/volume/v3/test_volume_backup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ class TestBackupShow(volume_fakes.TestVolume):
876876
def setUp(self):
877877
super().setUp()
878878

879-
self.volume_sdk_client.get_backup.return_value = self.backup
879+
self.volume_sdk_client.find_backup.return_value = self.backup
880880
# Get the command object to test
881881
self.cmd = volume_backup.ShowVolumeBackup(self.app, None)
882882

@@ -886,7 +886,7 @@ def test_backup_show(self):
886886
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
887887

888888
columns, data = self.cmd.take_action(parsed_args)
889-
self.volume_sdk_client.get_backup.assert_called_with(self.backup.id)
889+
self.volume_sdk_client.find_backup.assert_called_with(self.backup.id)
890890

891891
self.assertEqual(self.columns, columns)
892892
self.assertEqual(self.data, data)

openstackclient/volume/v2/volume_backup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def get_parser(self, prog_name):
439439

440440
def take_action(self, parsed_args):
441441
volume_client = self.app.client_manager.sdk_connection.volume
442-
backup = volume_client.get_backup(parsed_args.backup)
442+
backup = volume_client.find_backup(parsed_args.backup)
443443
columns = (
444444
"availability_zone",
445445
"container",

openstackclient/volume/v3/volume_backup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def get_parser(self, prog_name):
643643

644644
def take_action(self, parsed_args):
645645
volume_client = self.app.client_manager.sdk_connection.volume
646-
backup = volume_client.get_backup(parsed_args.backup)
646+
backup = volume_client.find_backup(parsed_args.backup)
647647
columns = (
648648
"availability_zone",
649649
"container",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed the ``openstack volume backup show`` command
5+
to show a backup by name.

0 commit comments

Comments
 (0)