From 8e277c64fb86dc1ca432e02b82accdcaf42a2779 Mon Sep 17 00:00:00 2001 From: "jiahui.qiang" Date: Mon, 9 Jan 2017 10:43:27 +0800 Subject: [PATCH] Fix port command for SDK >0.9.10 The port functional test can not be passed in my local environment. When 'dns_assignment' is None, the port create, show command will fail because parameter for 'utils.format_list_of_dicts' can not be None. Change-Id: Iebf16fb7ca681660c2b9ee7839a0629f38c6a38a --- openstackclient/network/v2/port.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 4525da1800..20f3ad75ec 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -35,6 +35,10 @@ def _format_admin_state(state): return 'UP' if state else 'DOWN' +def _format_dns_assignment(dns_assignment): + return utils.format_list_of_dicts(dns_assignment) \ + if dns_assignment else None + _formatters = { 'admin_state_up': _format_admin_state, 'is_admin_state_up': _format_admin_state, @@ -43,7 +47,7 @@ _formatters = { 'binding_vif_details': utils.format_dict, 'binding:profile': utils.format_dict, 'binding:vif_details': utils.format_dict, - 'dns_assignment': utils.format_list_of_dicts, + 'dns_assignment': _format_dns_assignment, 'extra_dhcp_opts': utils.format_list_of_dicts, 'fixed_ips': utils.format_list_of_dicts, 'security_group_ids': utils.format_list,