diff --git a/manilaclient/osc/v2/share_snapshots.py b/manilaclient/osc/v2/share_snapshots.py index 112827bd2..984f344e4 100644 --- a/manilaclient/osc/v2/share_snapshots.py +++ b/manilaclient/osc/v2/share_snapshots.py @@ -177,11 +177,17 @@ class ShowShareSnapshot(command.ShowOne): share_client.share_snapshot_export_locations.list( share_snapshot)) - export_locations = cliutils.convert_dict_list_to_string( - export_locations, ignored_keys=['links']) + locations = [] + for location in export_locations: + location._info.pop('links', None) + locations.append(location._info) + + if parsed_args.formatter == 'table': + locations = cliutils.convert_dict_list_to_string( + locations) data = share_snapshot._info - data['export_locations'] = export_locations + data['export_locations'] = locations data.pop('links', None) return self.dict2columns(data) diff --git a/manilaclient/tests/unit/osc/v2/test_share_snapshots.py b/manilaclient/tests/unit/osc/v2/test_share_snapshots.py index a19ecce95..ec3255df5 100644 --- a/manilaclient/tests/unit/osc/v2/test_share_snapshots.py +++ b/manilaclient/tests/unit/osc/v2/test_share_snapshots.py @@ -362,6 +362,7 @@ class TestShareSnapshotShow(TestShareSnapshot): self.data = self.share_snapshot._info.values() self.columns = self.share_snapshot._info.keys() + self.export_locations_mock.list.return_value = [self.export_location] def test_share_snapshot_show_missing_args(self): arglist = []