openstack server list returns "list index out of range" when there are no servers

Bug #1548674 reported by Pavlo Shchelokovskyy
This bug report is a duplicate of:  Bug #1539770: Empty set causing out of range error. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
New
Undecided
Unassigned

Bug Description

Started to see this just recently, running from master branch

$ . /opt/stack/devstack/openrc demo demo
$ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
$ openstack server list
list index out of range

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

only the table output formatter is affected, vaule, csv, json, yaml are fine. the traceback from "openstack --debug server list" is

RESP BODY: {"servers": []}

list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 378, in run_subcommand
    result = cmd.run(parsed_args)
  File "/opt/stack/python-openstackclient/openstackclient/common/command.py", line 37, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 88, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/local/lib/python2.7/dist-packages/cliff/lister.py", line 51, in produce_output
    parsed_args,
  File "/usr/local/lib/python2.7/dist-packages/cliff/formatters/table.py", line 64, in emit_list
    stdout, x, int(parsed_args.max_width), min_width)
  File "/usr/local/lib/python2.7/dist-packages/cliff/formatters/table.py", line 148, in _assign_max_widths
    first_line = x.get_string().splitlines()[0]
IndexError: list index out of range
clean_up ListServer: list index out of range
Traceback (most recent call last):
  File "/opt/stack/python-openstackclient/openstackclient/shell.py", line 113, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 258, in run
    result = self.run_subcommand(remainder)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 378, in run_subcommand
    result = cmd.run(parsed_args)
  File "/opt/stack/python-openstackclient/openstackclient/common/command.py", line 37, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 88, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/local/lib/python2.7/dist-packages/cliff/lister.py", line 51, in produce_output
    parsed_args,
  File "/usr/local/lib/python2.7/dist-packages/cliff/formatters/table.py", line 64, in emit_list
    stdout, x, int(parsed_args.max_width), min_width)
  File "/usr/local/lib/python2.7/dist-packages/cliff/formatters/table.py", line 148, in _assign_max_widths
    first_line = x.get_string().splitlines()[0]
IndexError: list index out of range

END return value: 1

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

cliff version is 1.17.0

Revision history for this message
Steve Martinelli (stevemar) wrote :

this was a bug that cliff introduced, it's been fixed in the latest release of cliff. Try using cliff v2.0.0.

https://bugs.launchpad.net/python-cliff/+bug/1539770

marking this as a dupe of that bug.

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.