summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v3/volume_attachment.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/volume/v3/volume_attachment.py')
-rw-r--r--openstackclient/volume/v3/volume_attachment.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/openstackclient/volume/v3/volume_attachment.py b/openstackclient/volume/v3/volume_attachment.py
index 39a9c37f..57a6da73 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):
@@ -73,7 +82,7 @@ class CreateVolumeAttachment(command.ShowOne):
the volume to the server at the hypervisor level. As a result, it should
typically only be used for troubleshooting issues with an existing server
in combination with other tooling. For all other use cases, the 'server
- volume add' command should be preferred.
+ add volume' command should be preferred.
"""
def get_parser(self, prog_name):