From 86a3c7a4159b8e978c5a90c66ded1f30944c1f45 Mon Sep 17 00:00:00 2001 From: Sindhu Devale Date: Wed, 2 Nov 2016 10:11:54 -0500 Subject: SDK refactor: Prepare floating ip commands Prepare the OSC "floating ip" commands for the SDK refactor. Change-Id: I02052185b3ce0b053acdcf76a0f68d49e6f7e608 Partially-Implements: blueprint network-command-sdk-support --- openstackclient/network/v2/floating_ip.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'openstackclient/network/v2/floating_ip.py') diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py index bb75540c..12a4754d 100644 --- a/openstackclient/network/v2/floating_ip.py +++ b/openstackclient/network/v2/floating_ip.py @@ -19,6 +19,14 @@ from osc_lib import utils from openstackclient.i18n import _ from openstackclient.network import common +from openstackclient.network import sdk_utils + + +def _get_network_columns(item): + column_map = { + 'tenant_id': 'project_id', + } + return sdk_utils.get_osc_show_columns_for_sdk_resource(item, column_map) def _get_columns(item): @@ -110,9 +118,9 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne): def take_action_network(self, client, parsed_args): attrs = _get_attrs(self.app.client_manager, parsed_args) obj = client.create_ip(**attrs) - columns = _get_columns(obj) + display_columns, columns = _get_network_columns(obj) data = utils.get_item_properties(obj, columns) - return (columns, data) + return (display_columns, data) def take_action_compute(self, client, parsed_args): obj = client.floating_ips.create(parsed_args.network) @@ -282,9 +290,9 @@ class ShowFloatingIP(common.NetworkAndComputeShowOne): def take_action_network(self, client, parsed_args): obj = client.find_ip(parsed_args.floating_ip, ignore_missing=False) - columns = _get_columns(obj) + display_columns, columns = _get_network_columns(obj) data = utils.get_item_properties(obj, columns) - return (columns, data) + return (display_columns, data) def take_action_compute(self, client, parsed_args): obj = utils.find_resource( -- cgit v1.2.1