"openstack project list --user <user>" exits with index out of range

Bug #1535449 reported by David Moreau Simard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Invalid
Low
Unassigned

Bug Description

Granted, there might be some configuration error around the heat_admin user here - however, OSC is not very helpful about it.
FWIW I thought it was because heat_admin wasn't in the services tenant but even after doing:
openstack user set 3d3d5aee81654d29b43caa330ebf2378 --project a6542148bace42c1bb442cda9dada65a

The error remains.

(Raw output here, may be more readable: http://paste.openstack.org/raw/484204/)

[root@n27 ~]# openstack user list
+----------------------------------+------------+
| ID | Name |
+----------------------------------+------------+
| 0f5fb3b47da14e19b8a39dad20dff35d | nova |
| 145d78112da945df82ab6eef473d33bf | sahara |
| 14a9ae9b039749dd83d7091bdfd80795 | heat |
| 3d3d5aee81654d29b43caa330ebf2378 | heat_admin |
| 464f3b67e6d54491ac296a6ceff6db31 | swift |
| 5df280cbec3f4852b94a054bf2a9ace8 | ironic |
| 670bb7d8c2614f009993e817591cbdef | neutron |
| cf75ce9ce1ff4b3abfea45677be5c971 | glance |
| f91a4e9af4004763aeee740bc2506c1e | admin |
+----------------------------------+------------+
[root@n27 ~]# openstack project list --user nova
+----------------------------------+----------+
| ID | Name |
+----------------------------------+----------+
| a6542148bace42c1bb442cda9dada65a | services |
+----------------------------------+----------+
[root@n27 ~]# openstack project list --user heat
+----------------------------------+----------+
| ID | Name |
+----------------------------------+----------+
| a6542148bace42c1bb442cda9dada65a | services |
+----------------------------------+----------+
[root@n27 ~]# openstack --debug project list --user heat_admin
START with options: ['--debug', 'project', 'list', '--user', 'heat_admin']
options: Namespace(access_token_endpoint='', auth_type='', auth_url='http://127.0.0.1:5000/v3/', cacert='', client_id='', client_secret='***', cloud='', debug=True, default_domain='default', deferred_help=False, domain_id='', domain_name='', endpoint='', identity_provider='', identity_provider_url='', insecure=None, interface='', log_file=None, os_baremetal_api_version='1.6', os_compute_api_version='', os_data_processing_api_version='1.1', os_data_processing_url='', os_identity_api_version='3', os_image_api_version='', os_key_manager_api_version='1', os_network_api_version='', os_object_api_version='', os_orchestration_api_version='1', os_project_id=None, os_project_name=None, os_volume_api_version='', password='***', project_domain_id='', project_domain_name='Default', project_id='', project_name='services', protocol='', region_name='', scope='', service_provider_endpoint='', timing=False, token='***', trust_id='', url='', user_domain_id='', user_domain_name='Default', user_id='', username='heat', 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', 'data_processing_api_version': '1.1', 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': '', 'api_timeout': None, u'baremetal_api_version': '1.6', 'auth': {'username': 'heat', 'project_name': 'services', 'user_domain_name': 'Default', 'auth_url': 'http://127.0.0.1:5000/v3/', 'password': '***', 'project_domain_name': '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': '1', 'timing': False, 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': '3', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', 'debug': True, u'interface': None, 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 3, cmd group openstack.identity.v3
object_store API version 1, cmd group openstack.object_store.v1
orchestration API version 1, cmd group openstack.orchestration.v1
key_manager API version 1, cmd group openstack.key_manager.v1
data_processing API version 1.1, cmd group openstack.data_processing.v1
baremetal API version 1.6, cmd group openstack.baremetal.v1
command: project list -> openstackclient.identity.v3.project.ListProject
Auth plugin password selected
auth_type: password
Using auth plugin: password
Using parameters {'username': 'heat', 'project_name': 'services', 'auth_url': 'http://127.0.0.1:5000/v3/', 'user_domain_name': 'Default', 'password': '***', 'project_domain_name': 'Default'}
Get auth_ref
REQ: curl -g -i -X GET http://127.0.0.1:5000/v3/ -H "Accept: application/json" -H "User-Agent: python-openstackclient keystoneauth1/2.2.1 python-requests/2.7.0 CPython/2.7.5 Linux/3.10.0-327.4.4.el7.x86_64 CPython/2.7.5"
Starting new HTTP connection (1): 127.0.0.1
"GET /v3/ HTTP/1.1" 200 190
RESP: [200] content-length: 190 content-encoding: gzip vary: X-Auth-Token,Accept-Encoding server: Apache/2.4.6 (CentOS) connection: close date: Mon, 18 Jan 2016 21:17:48 GMT content-type: application/json x-openstack-request-id: req-634cce3a-cc21-4fd9-aacb-6a84e953a8eb
RESP BODY: {"version": {"status": "stable", "updated": "2015-09-15T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.5", "links": [{"href": "http://127.0.0.1:5000/v3/", "rel": "self"}]}}

Making authentication request to http://127.0.0.1:5000/v3/auth/tokens
Resetting dropped connection: 127.0.0.1
"POST /v3/auth/tokens HTTP/1.1" 201 6361
take_action(Namespace(columns=[], domain=None, formatter='table', long=False, max_width=0, noindent=False, quote_mode='nonnumeric', user='heat_admin'))
Instantiating identity client: <class 'keystoneclient.v3.client.Client'>
Making authentication request to http://127.0.0.1:5000/v3/auth/tokens
Resetting dropped connection: 127.0.0.1
"POST /v3/auth/tokens HTTP/1.1" 201 6361
REQ: curl -g -i -X GET http://127.0.0.1:35357/ -H "Accept: application/json" -H "User-Agent: python-openstackclient keystoneauth1/2.2.1 python-requests/2.7.0 CPython/2.7.5 Linux/3.10.0-327.4.4.el7.x86_64 CPython/2.7.5"
Starting new HTTP connection (1): 127.0.0.1
"GET / HTTP/1.1" 300 589
RESP: [300] content-length: 589 vary: X-Auth-Token server: Apache/2.4.6 (CentOS) connection: close date: Mon, 18 Jan 2016 21:17:48 GMT content-type: application/json
RESP BODY: {"versions": {"values": [{"status": "stable", "updated": "2015-09-15T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.5", "links": [{"href": "http://127.0.0.1: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://127.0.0.1:35357/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}]}}

REQ: curl -g -i -X GET http://127.0.0.1:35357/v3/users/heat_admin -H "User-Agent: python-keystoneclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}5206133e08d34c0ff5ca132bce8bd5e0b3ecdf31"
Resetting dropped connection: 127.0.0.1
"GET /v3/users/heat_admin HTTP/1.1" 404 92
RESP: [404] content-length: 92 vary: X-Auth-Token server: Apache/2.4.6 (CentOS) connection: close date: Mon, 18 Jan 2016 21:17:48 GMT content-type: application/json x-openstack-request-id: req-62d5afc7-ff15-418e-9cf0-1ff21cc9ad14
RESP BODY: {"error": {"message": "Could not find user: heat_admin", "code": 404, "title": "Not Found"}}

Request returned failure status: 404
REQ: curl -g -i -X GET http://127.0.0.1:35357/v3/users?name=heat_admin -H "User-Agent: python-keystoneclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}5206133e08d34c0ff5ca132bce8bd5e0b3ecdf31"
Resetting dropped connection: 127.0.0.1
"GET /v3/users?name=heat_admin HTTP/1.1" 200 255
RESP: [200] content-length: 255 content-encoding: gzip vary: X-Auth-Token,Accept-Encoding server: Apache/2.4.6 (CentOS) connection: close date: Mon, 18 Jan 2016 21:17:48 GMT content-type: application/json x-openstack-request-id: req-0d350489-72ef-40e8-8d44-1f601575fea8
RESP BODY: {"users": [{"domain_id": "7310aa5ea8424fa08be53ca227186fb4", "name": "heat_admin", "links": {"self": "http://127.0.0.1:35357/v3/users/3d3d5aee81654d29b43caa330ebf2378"}, "id": "3d3d5aee81654d29b43caa330ebf2378", "enabled": true, "email": "heat_admin@localhost", "default_project_id": "a6542148bace42c1bb442cda9dada65a"}], "links": {"self": "http://127.0.0.1:35357/v3/users?name=heat_admin", "previous": null, "next": null}}

REQ: curl -g -i -X GET http://127.0.0.1:35357/v3/users/3d3d5aee81654d29b43caa330ebf2378/projects -H "User-Agent: python-keystoneclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}5206133e08d34c0ff5ca132bce8bd5e0b3ecdf31"
Resetting dropped connection: 127.0.0.1
"GET /v3/users/3d3d5aee81654d29b43caa330ebf2378/projects HTTP/1.1" 200 140
RESP: [200] content-length: 140 content-encoding: gzip vary: X-Auth-Token,Accept-Encoding server: Apache/2.4.6 (CentOS) connection: close date: Mon, 18 Jan 2016 21:17:48 GMT content-type: application/json x-openstack-request-id: req-e521de96-031b-4937-adf3-d08c31de9a39
RESP BODY: {"links": {"self": "http://127.0.0.1:35357/v3/users/3d3d5aee81654d29b43caa330ebf2378/projects", "previous": null, "next": null}, "projects": []}

list index out of range
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 379, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/lib/python2.7/site-packages/cliff/lister.py", line 56, in produce_output
    parsed_args,
  File "/usr/lib/python2.7/site-packages/cliff/formatters/table.py", line 64, in emit_list
    stdout, x, int(parsed_args.max_width), min_width)
  File "/usr/lib/python2.7/site-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 ListProject: list index out of range
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 113, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 259, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 379, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/lib/python2.7/site-packages/cliff/lister.py", line 56, in produce_output
    parsed_args,
  File "/usr/lib/python2.7/site-packages/cliff/formatters/table.py", line 64, in emit_list
    stdout, x, int(parsed_args.max_width), min_width)
  File "/usr/lib/python2.7/site-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

description: updated
Revision history for this message
David Moreau Simard (dmsimard) wrote :
Download full text (4.5 KiB)

It looks like the heat_admin user did not have a proper role on the services tenant ?

Raw format for better readability: http://paste.openstack.org/raw/484208/

[root@n27 ~]# openstack role assignment list
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| Role | User | Group | Project | Domain | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 0f5fb3b47da14e19b8a39dad20dff35d | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 145d78112da945df82ab6eef473d33bf | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 14a9ae9b039749dd83d7091bdfd80795 | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 464f3b67e6d54491ac296a6ceff6db31 | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 5df280cbec3f4852b94a054bf2a9ace8 | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 670bb7d8c2614f009993e817591cbdef | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | cf75ce9ce1ff4b3abfea45677be5c971 | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | f91a4e9af4004763aeee740bc2506c1e | | a779793672254183bba23dabdd6f9bcd | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 3d3d5aee81654d29b43caa330ebf2378 | | | 7310aa5ea8424fa08be53ca227186fb4 | False |
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+

[root@n27 ~]# openstack role show 8cb02ff4fcc1486fa758caba1b1ee9b8
+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
| id | 8cb02ff4fcc1486fa758caba1b1ee9b8 |
| name | admin |
+-------+----------------------------------+

[root@n27 ~]# openstack project show a6542148bace42c1bb442cda9dada65a
+-------------+-----------------------------------+
| Field | Value |
+-------------+-----------------------------------+
| description | Tenant for the openstack services |
| domain_id | default |
| enabled | True |
| id | a6542148bace42c1bb442cda9dada65a |
| is_domain | False |
| name | services |
| parent_id | None |
+-------------+-----------------------------------+

[root@n27 ~]# openstack role assignment list
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| Role | User | Group | Project | Domain | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 0f5fb3b47da14e19b8a39dad20dff35d | | a6542148bace42c1bb442cda9dada65a | | False |
| 8cb02ff4fcc1486fa758caba1b1ee9b8 | 145d78112da945df82ab6eef473d33bf | | a6542148bace42c1bb442cda9dada65a | | F...

Read more...

Revision history for this message
Dean Troyer (dtroyer) wrote :

Summarize the current state: the root cause of the issue was a missing role, OSC needs to handle the returned error gracefully.

Changed in python-openstackclient:
status: New → Confirmed
importance: Undecided → Low
AMIT KUMAR (maurya0092)
Changed in python-openstackclient:
assignee: nobody → AMIT KUMAR (maurya0092)
Revision history for this message
Steve Martinelli (stevemar) wrote :

Automatically unassigning due to inactivity.

Changed in python-openstackclient:
assignee: AMIT KUMAR (maurya0092) → nobody
Revision history for this message
Steve Martinelli (stevemar) wrote :

Is this still an issue?

Revision history for this message
QiangTang (qtang) wrote :

I am confused by the issue title and lookup into the help but got this:

pe-office:cinder$ openstack help project list
usage: openstack project list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}] [--long]

List projects

optional arguments:
  -h, --help show this help message and exit
  --long List additional fields in output

output formatters:
  output formatter options

  -f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated

table formatter:
  --max-width <integer>
                        Maximum display width, <1 to disable. You can also use
                        the CLIFF_MAX_TERM_WIDTH environment variable, but the
                        parameter takes precedence.

json formatter:
  --noindent whether to disable indenting the JSON

CSV Formatter:
  --quote {all,minimal,none,nonnumeric}
                        when to include quotes, defaults to nonnumeric
pe-office:cinder$ openstack --version
openstack 3.0.1

Does the --user option existing under the project list ?

Revision history for this message
Vijendra Soni (vijendra-soni) wrote :

Seems like this bug is no longer valid. I got the below output saying "unrecognized arguments: --user" while trying to reproduce the bug:

stack@ubuntu:~/devstack$ openstack project list --user demmo
usage: openstack project list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}] [--long]
openstack project list: error: unrecognized arguments: --user demmo
stack@ubuntu:~/devstack$ openstack project list --user nova
usage: openstack project list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}] [--long]
openstack project list: error: unrecognized arguments: --user nova
stack@ubuntu:~/devstack$ openstack project list --user heat
usage: openstack project list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}] [--long]
openstack project list: error: unrecognized arguments: --user heat

openstack project list --help shows:

openstack project list --help
usage: openstack project list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}] [--long]

List projects

optional arguments:
  -h, --help show this help message and exit
  --long List additional fields in output

output formatters:
  output formatter options

  -f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated

table formatter:
  --max-width <integer>
                        Maximum display width, <1 to disable. You can also use
                        the CLIFF_MAX_TERM_WIDTH environment variable, but the
                        parameter takes precedence.

json formatter:
  --noindent whether to disable indenting the JSON

CSV Formatter:
  --quote {all,minimal,none,nonnumeric}
                        when to include quotes, defaults to nonnumeric

Changing the bug status to invalid.

Thanks,
Vijendra Soni

Changed in python-openstackclient:
status: Confirmed → Invalid
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.