Project

General

Profile

Actions

Bug #13315

closed

openstack: TypeError: string indices must be integers

Added by Loïc Dachary over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description


DEBUG:teuthology.misc:openstack server show -f json teuthology output

 "OS-EXT-STS:task_state": null,
  "addresses": ³Primary_External_Net=<ip-address>",
  "image": "teuthology-ubuntu-14.04
(10e6d3b1-f94a-4220-a00f-3e3a13f349e0)",
  "OS-EXT-STS:vm_state": "active",
  "OS-EXT-SRV-ATTR:instance_name": "instance-000026e8",
  "OS-SRV-USG:launched_at": "2015-09-28T10:33:09.000000",
  "flavor": "m1.small (2)",
  "id": "79a41b6f-f379-4d14-98ac-e73cb42cfa48",
  "security_groups": [
    {
      "name": "teuthology" 
    }
  ],
  "user_id": "281f9aa2d9c54177b45e72db742b4744",
  "OS-DCF:diskConfig": "MANUAL",
  "accessIPv4": "",
  "accessIPv6": "",
  "progress": 0,
  "OS-EXT-STS:power_state": 1,
  "OS-EXT-AZ:availability_zone": "az3",
  "config_drive": "",
  "status": "ACTIVE",
  "updated": "2015-09-28T10:33:09Z",
  "hostId": "b205fbea7ee98ef482712db93325a1d7d44d7694a8ec9fce7df038c3",
  "OS-EXT-SRV-ATTR:host": ³hostname",
  "OS-SRV-USG:terminated_at": null,
  "key_name": "ceph_test_key",
  "properties": "",
  "project_id": "1d0137fe585742bdbe13e2b16daab6ff",
  "OS-EXT-SRV-ATTR:hypervisor_hostname": ³hostname",
  "name": "teuthology",
  "created": "2015-09-28T10:32:47Z",
  "os-extended-volumes:volumes_attached": []
}
Traceback (most recent call last):
  File "/opt/teuthology/virtualenv/bin/teuthology-openstack", line 9, in
<module>
    load_entry_point('teuthology==0.1.0', 'console_scripts',
'teuthology-openstack')()
  File "/opt/teuthology/scripts/openstack.py", line 8, in main
    teuthology.openstack.main(parse_args(argv), argv)
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 622, in
main
    return TeuthologyOpenStack(ctx, teuth_config, argv).main()
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 284, in
main
    ip = self.setup()
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 338, in
setup
    if not self.cluster_exists():
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 607, in
cluster_exists
    instance_id = self.get_instance_id(self.args.name)
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 565, in
get_instance_id
    return TeuthologyOpenStack.get_value(instance, 'id')
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 75, in
get_value
    return filter(lambda v: v['Field'] == field, result)[0]['Value']
  File "/opt/teuthology/teuthology/openstack/__init__.py", line 75, in
<lambda>
    return filter(lambda v: v['Field'] == field, result)[0]['Value']
TypeError: string indices must be integers
<pre>
Actions #1

Updated by Loïc Dachary over 8 years ago

The python-cliff package that comes with Ubuntu is

ii  python-cliff                                                  1.4.5-1ubuntu2                      all                                 command line interface formulation framework - Python 2.x

and formats differently from python-cliff >= 1.15. It does:
openstack flavor show -f json
m1.tiny
{
  "name": "m1.tiny",
  "ram": 512,
  "properties": "general='true'",
  "OS-FLV-DISABLED:disabled": false,
  "vcpus": 1,
  "swap": "",
  "os-flavor-access:is_public": true,
  "rxtx_factor": 1.0,
  "OS-FLV-EXT-DATA:ephemeral": 0,
  "disk": 1,
  "id": "1" 
}

where the json formatter of python-cliff >= 1.15 does
$ openstack flavor show -f json eg-60
[{"Field": "OS-FLV-DISABLED:disabled", "Value": false}, {"Field": "OS-FLV-EXT-DATA:ephemeral", "Value": 0}, {"Field": "disk", "Value": 1600}, {"Field": "id", "Value": "0297d7ac-fe6f-4ff1-b6e7-0b8b0908c94f"}, {"Field": "name", "Value": "eg-60"}, {"Field": "os-flavor-access:is_public", "Value": true}, {"Field": "properties", "Value": "kind='ovh.steadfast.cpu', ovh:shared_storage='True', quota:disk_total_bytes_sec='104857600'"}, {"Field": "ram", "Value": 60000}, {"Field": "rxtx_factor", "Value": 1.0}, {"Field": "swap", "Value": ""}, {"Field": "vcpus", "Value": 16}]

The actual json formatter loaded can be found with

$ strace -e open openstack flavor show -f json eg-60 2>&1 | grep json | grep cliff
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json_format.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json_format.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json_formatmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json_format.py", O_RDONLY) = 3
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json_format.pyc", O_RDONLY) = 4
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/jsonmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/tmp/python-openstackclient/v/local/lib/python2.7/site-packages/cliff/formatters/json.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)

Despite the fact that teuthology runs virtualenv --system-site-packages, there should be no problem even if python-cliff is installed because the version installed in the teuthology virtualenv is higher than the one found in system packages.

It looks like it's possible to load the wrong formatter plugin via http://docs.openstack.org/developer/stevedore/ under some circumstances. Fixing such a problem is however outside of the scope of teuthology.

Actions #2

Updated by Greg Farnum over 8 years ago

  • Status changed from Won't Fix to 12

This is happening to me on our ovh teuthology box now. See http://pulpito.ovh.sepia.ceph.com:8081/gregf-2016-01-14_22:21:06-fs-master---basic-openstack/.

I tried updating teuthology (from 3633020 to 5b67b91), clearing out the virtualenv, and running "./bootstrap" but the same issue persists (http://pulpito.ovh.sepia.ceph.com:8081/gregf-2016-01-14_23:30:23-fs-master---basic-openstack/).

Actions #3

Updated by Greg Farnum over 8 years ago

Also, I didn't make any manual changes to anything between when I scheduled the (basically successful) gregf-2015-12-23_05:34:31-fs-master---basic-openstack and the broken run.

Actions #4

Updated by Zack Cerza over 8 years ago

  • Status changed from 12 to Resolved
  • Assignee changed from Loïc Dachary to Zack Cerza

This PR ought to resolve the last of those issues:
https://github.com/ceph/teuthology/pull/771

Actions

Also available in: Atom PDF