diff options
| author | Zuul <zuul@review.opendev.org> | 2022-06-27 15:54:20 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2022-06-27 15:54:20 +0000 |
| commit | 30622272e39c5feaba6f04b21ffd09b8f21e290b (patch) | |
| tree | 9988abddab5f11b438be1ed0abf529e2f8c8e3ab /openstackclient/volume | |
| parent | 604ceeedf98e06a07f861a628b931033f5509c79 (diff) | |
| parent | 045f2e7e0618fdf22c260625d64554382afefde1 (diff) | |
| download | python-openstackclient-30622272e39c5feaba6f04b21ffd09b8f21e290b.tar.gz | |
Merge "volume: Correct output of 'volume attachment create'"
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/v3/volume_attachment.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/openstackclient/volume/v3/volume_attachment.py b/openstackclient/volume/v3/volume_attachment.py index 39a9c37f..c7401837 100644 --- a/openstackclient/volume/v3/volume_attachment.py +++ b/openstackclient/volume/v3/volume_attachment.py @@ -51,18 +51,27 @@ def _format_attachment(attachment): 'Properties', ) - # TODO(stephenfin): Improve output with the nested connection_info - # field - cinderclient printed two things but that's equally ugly - return ( - column_headers, - utils.get_item_properties( + # VolumeAttachmentManager.create returns a dict while everything else + # returns a VolumeAttachment object + if isinstance(attachment, dict): + data = [] + for column in columns: + if column == 'connection_info': + data.append(format_columns.DictColumn(attachment[column])) + continue + data.append(attachment[column]) + else: + data = utils.get_item_properties( attachment, columns, formatters={ 'connection_info': format_columns.DictColumn, }, - ), - ) + ) + + # TODO(stephenfin): Improve output with the nested connection_info + # field - cinderclient printed two things but that's equally ugly + return (column_headers, data) class CreateVolumeAttachment(command.ShowOne): |
