Cliff parser returns "list index out of range" on empty array

Bug #1546471 reported by Proskurin Kirill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Fix Released
Medium
Boris Bobrov

Bug Description

Tested with MOS8 packages:

root@729012-comp-disk-260:~/kolla-mesos# openstack --debug image list
START with options: ['--debug', 'image', 'list']
options: Namespace(access_token_endpoint='', auth_type='', auth_url='http://172.20.9.27:35357', cacert='', client_id='', client_secret='***', cloud='', debug=True, default_domain='default', deferred_help=False, domain_id='', domain_name='', endpoint='', identity_provider='', insecure=None, interface='', log_file=None, os_compute_api_version='', os_identity_api_version='', os_image_api_version='', os_network_api_version='', os_object_api_version='', os_project_id=None, os_project_name=None, os_volume_api_version='2', password='***', project_domain_id='default', project_domain_name='', project_id='', project_name='admin', protocol='', region_name='RegionOne', scope='', timing=False, token='***', trust_id='', url='', user_domain_id='default', user_domain_name='', user_id='', username='admin', verbose_level=3, verify=None)
defaults: {u'auth_type': 'password', u'compute_api_version': u'2', 'key': None, u'database_api_version': u'1.0', 'api_timeout': None, u'baremetal_api_version': u'1', u'image_api_version': u'2', 'cacert': None, u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': u'1', u'interface': None, u'network_api_version': u'2', u'image_format': u'qcow2', u'key_manager_api_version': u'v1', u'metering_api_version': u'2', 'verify': True, u'identity_api_version': u'2.0', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'container_api_version': u'1', u'dns_api_version': u'2', u'object_store_api_version': u'1', u'disable_vendor_agent': {}}
cloud cfg: {'auth_type': 'password', u'compute_api_version': u'2', 'key': None, u'database_api_version': u'1.0', 'timing': False, u'network_api_version': u'2', u'image_format': u'qcow2', u'image_api_version': u'2', 'verify': True, u'dns_api_version': u'2', u'object_store_api_version': u'1', 'verbose_level': 3, 'region_name': 'RegionOne', 'api_timeout': None, u'baremetal_api_version': u'1', 'auth': {'username': 'admin', 'project_name': 'admin', 'user_domain_id': 'default', 'auth_url': 'http://172.20.9.27:35357', 'password': '***', 'project_domain_id': 'default'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': u'1', u'interface': None, 'cacert': None, u'key_manager_api_version': u'v1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', u'volume_api_version': '2', 'cert': None, u'secgroup_source': u'neutron', 'debug': True, u'disable_vendor_agent': {}}
compute API version 2, cmd group openstack.compute.v2
network API version 2, cmd group openstack.network.v2
image API version 2, cmd group openstack.image.v2
volume API version 2, cmd group openstack.volume.v2
identity API version 2.0, cmd group openstack.identity.v2
object_store API version 1, cmd group openstack.object_store.v1
command: image list -> openstackclient.image.v2.image.ListImage
Auth plugin password selected
auth_type: password
Using auth plugin: password
Using parameters {'username': 'admin', 'project_name': 'admin', 'auth_url': 'http://172.20.9.27:35357', 'user_domain_id': 'default', 'password': '***', 'project_domain_id': 'default'}
Get auth_ref
REQ: curl -g -i -X GET http://172.20.9.27:35357 -H "Accept: application/json" -H "User-Agent: python-openstackclient keystoneauth1/2.2.0 python-requests/2.9.1 CPython/2.7.6"
Starting new HTTP connection (1): 172.20.9.27
"GET / HTTP/1.1" 300 593
RESP: [300] Content-Length: 593 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.7 (Ubuntu) Connection: Keep-Alive Date: Tue, 16 Feb 2016 16:06:03 GMT Content-Type: application/json
RESP BODY: {"versions": {"values": [{"status": "stable", "updated": "2015-03-30T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.4", "links": [{"href": "http://172.20.9.27:35357/v3/", "rel": "self"}]}, {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://172.20.9.27:35357/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}]}}

Making authentication request to http://172.20.9.27:35357/v3/auth/tokens
"POST /v3/auth/tokens HTTP/1.1" 201 2864
run(Namespace(columns=[], formatter='table', limit=None, long=False, marker=None, max_width=0, noindent=False, page_size=None, private=False, property=None, public=False, quote_mode='nonnumeric', shared=False, sort=None))
Instantiating image client: <class 'glanceclient.v2.client.Client'>
Making authentication request to http://172.20.9.27:35357/v3/auth/tokens
"POST /v3/auth/tokens HTTP/1.1" 201 2864
Instantiating image api: <class 'openstackclient.api.image_v2.APIv2'>
REQ: curl -g -i -X GET http://172.20.9.27:9292/v2/images -H "User-Agent: python-openstackclient keystoneauth1/2.2.0 python-requests/2.9.1 CPython/2.7.6" -H "X-Auth-Token: {SHA1}7e6b8e01e17f73e258e31cae8556a3dc23dab80e"
Starting new HTTP connection (1): 172.20.9.27
"GET /v2/images HTTP/1.1" 200 69
RESP: [200] Date: Tue, 16 Feb 2016 16:06:05 GMT Connection: keep-alive Content-Type: application/json; charset=UTF-8 Content-Length: 69 X-Openstack-Request-Id: req-a81c1aaf-9574-406f-a8aa-677bc4e59693
RESP BODY: {"images": [], "schema": "/v2/schemas/images", "first": "/v2/images"}

list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 379, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/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 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/local/lib/python2.7/dist-packages/cliff/lister.py", line 56, 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 ListImage: list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/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 259, in run
    result = self.run_subcommand(remainder)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 379, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/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 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/local/lib/python2.7/dist-packages/cliff/lister.py", line 56, 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

Same for openstack network list, etc. On any empty array.

Revision history for this message
Boris Bobrov (bbobrov) wrote :
Changed in mos:
assignee: nobody → Boris Bobrov (bbobrov)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Boris Bobrov (bbobrov) wrote :

I'm setting this as `triaged` because there is a patch to upstream

Revision history for this message
Alexander Petrov (apetrov-n) wrote :

I can't reproduce this bug on MOS8 build 569

http://paste.openstack.org/show/487244/

Revision history for this message
Proskurin Kirill (kproskurin) wrote :

Guys, I was a bit confused, this bug related to pip version of cli( python-openstackclient 2.1.0) and it's not affect MOS pkgs,
So feel free to close this bug.

Revision history for this message
Boris Bobrov (bbobrov) wrote :

Cool, I'm targeting it to 9.0 then.

Changed in mos:
milestone: none → 9.0
Revision history for this message
Boris Bobrov (bbobrov) wrote :

This was fixed in upstream

Changed in mos:
status: Triaged → Fix Released
status: Fix Released → Fix Committed
tags: added: area-keystone
Changed in mos:
status: Fix Committed → 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.