Subnet show does not order dns_nameservers correctly

Bug #2053201 reported by Brian Haley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Undecided
Brian Haley

Bug Description

The dns_nameservers field of a subnet is ordered, but OSC uses format_columns.ListColumn() class for printing, which uses sorted(), so no matter the order in the neutron DB, they are always displayed in numerical (or string) order.

$ openstack subnet set --no-dns-nameserver --dns-nameserver 8.8.8.8 --dns-nameserver 4.4.4.4 private-subnet --debug

<snip>
RESP BODY: {"subnet":{"id":"23a06d92-c1ec-4edc-87aa-301fde2aed76","name":"private-subnet","tenant_id":"a01436473de444f58ed3ad3c742247ce","network_id":"3ff92bae-5424-48c2-9e61-e37a3ee3b62f","ip_version":4,"subnetpool_id":"603cae39-50c6-429d-a6a1-c6bcb2916567","enable_dhcp":true,"ipv6_ra_mode":null,"ipv6_address_mode":null,"gateway_ip":"10.0.0.1","cidr":"10.0.0.0/26","allocation_pools":[{"start":"10.0.0.2","end":"10.0.0.62"}],"host_routes":[],"dns_nameservers":["8.8.8.8","4.4.4.4"],"description":"","service_types":[],"tags":[],"created_at":"2024-02-13T21:42:34Z","updated_at":"2024-02-13T23:09:56Z","revision_number":11,"project_id":"a01436473de444f58ed3ad3c742247ce"}}
<snip>

$ openstack subnet show 23a06d92-c1ec-4edc-87aa-301fde2aed76 | grep dns_nameservers
| dns_nameservers | 4.4.4.4, 8.8.8.8 |

Getting by value is correct:

$ openstack subnet show 23a06d92-c1ec-4edc-87aa-301fde2aed76 -f value -c dns_nameservers
['8.8.8.8', '4.4.4.4']

Changed in python-openstackclient:
assignee: nobody → Brian Haley (brian-haley)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (master)
Changed in python-openstackclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.opendev.org/c/openstack/python-openstackclient/+/909058
Committed: https://opendev.org/openstack/python-openstackclient/commit/75ed315885b9f6f433a791bb3e55cf657d01de83
Submitter: "Zuul (22348)"
Branch: master

commit 75ed315885b9f6f433a791bb3e55cf657d01de83
Author: Brian Haley <email address hidden>
Date: Wed Feb 14 17:28:04 2024 -0500

    Do not sort subnet dns_nameservers field

    When using table output format, the dns_nameservers field
    of a subnet is sorted, but it should not be as the order
    is important.

    Created an UnsortedListColumn() class in subnet.py so the
    output is correct.

    Updated the unit test accordingly to verify the order is
    correct when an entry is removed.

    Change-Id: I60a15a944f83549738305dd025db38ff8e165be7
    Closes-bug: #2053201

Changed in python-openstackclient:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.