Ironic list commands returned with a subset of a resource attributes should be consistent type on valid fields input.

Bug #1509191 reported by Kan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
In Progress
Medium
haris

Bug Description

Take 'node' as an example, the valid fields are as follows:

Valid fields are: chassis_uuid, created_at, clean_step, console_enabled, driver, driver_info, driver_internal_info, extra, instance_info, instance_uuid, last_error, maintenance, maintenance_reason, power_state, properties, provision_state, provision_updated_at, reservation, target_power_state, target_provision_state, updated_at, inspection_finished_at, inspection_started_at, uuid, name.

But when using the fields in resource.lables such as 'UUID' instead of 'uuid' in resource.fileds, there will be an error like:
ubuntu@acdc-ironicclient:~/devstack$ ironic node-list --fields UUID
usage: ironic node-list [--limit <limit>] [--marker <node>]
            [--sort-key <field>] [--sort-dir <direction>]
            [--maintenance <boolean>] [--associated <boolean>]
            [--provision-state <provision-state>] [--detail]
            [--fields <field> [<field> ...]]
ironic node-list: error: Invalid field(s) requested: UUID. Valid fields are: chassis_uuid, created_at, clean_step, console_enabled, driver, driver_info, driver_internal_info, extra, instance_info, instance_uuid, last_error, maintenance, maintenance_reason, power_state, properties, provision_state, provision_updated_at, reservation, target_power_state, target_provision_state, updated_at, inspection_finished_at, inspection_started_at, uuid, name.

When using the correct field 'uuid', the output is like:
ubuntu@acdc-ironicclient:~/devstack$ ironic node-list --fields uuid
+--------------------------------------+
| UUID |
+--------------------------------------+
| 0a1d4968-8dcf-42c7-93b5-5cca074430db |
| a62fb720-d5e1-4c37-b171-fb3c55139f43 |
| 7feb31d8-366b-4b17-9e36-f2802c07df5f |
+--------------------------------------+

So, although the output is shown as 'UUID', it can not be used in the fields arguments.

Comparing with the 'sort-key' arguments in list command:
ubuntu@acdc-ironicclient:~/devstack$ ironic node-list --sort-key abc
usage: ironic node-list [--limit <limit>] [--marker <node>]
            [--sort-key <field>] [--sort-dir <direction>]
            [--maintenance <boolean>] [--associated <boolean>]
            [--provision-state <provision-state>] [--detail]
            [--fields <field> [<field> ...]]
ironic node-list: error: abc is an invalid field for sorting, valid values for --sort-key are: ['target_power_state', 'target_provision_state', 'last_error', 'updated_at', 'maintenance_reason', 'Target Power State', 'Maintenance', 'provision_state', 'Created At', 'Console Enabled', 'Maintenance Reason', 'uuid', 'name', 'console_enabled', 'Driver', 'Target Provision State', 'provision_updated_at', 'maintenance', 'Reservation', 'power_state', 'Power State', 'inspection_started_at', 'inspection_finished_at', 'Name', 'Provisioning State', 'driver', 'reservation', 'Inspection Started At', 'Instance UUID', 'instance_uuid', 'UUID', 'Inspection Finished At', 'created_at', 'Last Error', 'Updated At', 'Provision Updated At']

The error info shows the valid values containing resource.fields and resource.labels.
So, for 'fields' argument, the error info of valid fields should contain both resource.fields and resource.labels, just like 'sort-key' does.

The commands are:
chassis-list
chassis-node-list
node-list
node-port-list
port-list
chassis-show
node-show
port-show

Kan (kansks)
Changed in python-ironicclient:
assignee: nobody → Kan (kansks)
description: updated
Kan (kansks)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/245541

Changed in python-ironicclient:
status: New → In Progress
Dmitry Tantsur (divius)
Changed in python-ironicclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-ironicclient (master)

Change abandoned by Dmitry Tantsur (<email address hidden>) on branch: master
Review: https://review.openstack.org/245541
Reason: Hi! This patch has been around for nearly six months with negative feedback, so I abandon it. I do see point in the fix, however, so feel free to restore it if you plan to continue working on it.

Dmitry Tantsur (divius)
Changed in python-ironicclient:
status: In Progress → Triaged
assignee: Kan (kansks) → nobody
tags: added: low-hanging-fruit
Harish Kumar (hkumarmk)
Changed in python-ironicclient:
assignee: nobody → Harish Kumar (hkumarmk)
Harish Kumar (hkumarmk)
Changed in python-ironicclient:
assignee: Harish Kumar (hkumarmk) → nobody
haris (haristanvir)
Changed in python-ironicclient:
assignee: nobody → haris (haristanvir)
haris (haristanvir)
Changed in python-ironicclient:
assignee: haris (haristanvir) → nobody
haris (haristanvir)
Changed in python-ironicclient:
assignee: nobody → haris (haristanvir)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/380671

Changed in python-ironicclient:
status: Triaged → In Progress
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.