Skip to content

Commit 42d050b

Browse files
committed
Fix volume group create from source to use dict access
When creating a volume group from a source group or group snapshot, the create_group_from_source API returns a dictionary rather than an SDK resource object. This change updates the code to access the group ID using dictionary notation (group['id']) instead of attribute access (group.id). Updated unit tests to mock create_group_from_source with a dictionary return value to match the actual API behavior. Assisted-By: Claude Sonnet 4.5 Change-Id: Icefc4f2237f39f1ab52837f8ad8cebf0869c3b99 Signed-off-by: rajathere <rajatdhasmana@gmail.com>
1 parent caec5c3 commit 42d050b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def setUp(self):
7474
)
7575
self.volume_client.create_group.return_value = self.fake_volume_group
7676
self.volume_client.get_group.return_value = self.fake_volume_group
77-
self.volume_client.create_group_from_source.return_value = (
78-
self.fake_volume_group
79-
)
77+
self.volume_client.create_group_from_source.return_value = {
78+
'id': self.fake_volume_group.id
79+
}
8080
self.volume_client.find_group_snapshot.return_value = (
8181
self.fake_volume_group_snapshot
8282
)

openstackclient/volume/v3/volume_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def take_action(
269269
name=parsed_args.name,
270270
description=parsed_args.description,
271271
)
272-
group = volume_client.get_group(group.id)
272+
group = volume_client.get_group(group['id'])
273273
return _format_group(group)
274274

275275

0 commit comments

Comments
 (0)