core.cloud.openstack Error Fetching Image List

Running into an issue on 2.0 rc2 and latest dev version (2.1)

TASK [common : launch a compute instance] **************************************
task path: /home/cluser/automata_ansible/automata_ansible_openstack/openstack/roles/common/tasks/main.yml:2
ESTABLISH LOCAL CONNECTION FOR USER: root
localhost EXEC ( umask 22 && mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1449770098.45-120356728371449 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1449770098.45-120356728371449 )” )
localhost PUT /tmp/tmpCI8UeX TO /root/.ansible/tmp/ansible-tmp-1449770098.45-120356728371449/os_server
localhost EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1449770098.45-120356728371449/os_server; rm -rf “/root/.ansible/tmp/ansible-tmp-1449770098.45-120356728371449/” > /dev/null 2>&1
fatal: [localhost]: FAILED! => {“changed”: false, “extra_data”: null, “failed”: true, “invocation”: {“module_args”: {“auth”: {“auth_url”: “http://172.16.0.6:5000/v2.0/”, “password”: “admin”, “project_name”: “admin”, “username”: “admin”}, “auto_ip”: true, “availability_zone”: “nova”, “flavor”: 3, “image”: “ubuntu_trusty”, “key_name”: “test”, “name”: “vm2”, “nics”: [{“net-id”: “f4d99c4b-0931-4a3a-b884-2129816b1db1”}], “security_groups”: “default”, “state”: “present”, “timeout”: 200}, “module_name”: “os_server”}, “msg”: “Error fetching image list: ‘module’ object has no attribute ‘packages’”}

I put in various checks along os_server.py but it seems the issue is coming from cloud.get_image_id() which eventually leads to def list_images() here
https://github.com/openstack-infra/shade/blob/master/shade/openstackcloud.py#L1163-L1165

The old nova_server module works fine, so not sure what the issue is.

This is from the inventory script. Everything is fine until it hits glance to pull the image object.

Couldn’t construct image object
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/shade/openstackcloud.py”, line 254, in _get_client
**kwargs)
File “/usr/local/lib/python2.7/dist-packages/os_client_config/cloud_config.py”, line 300, in get_legacy_client
return client_class(*constructor_args, **constructor_kwargs)
File “/usr/local/lib/python2.7/dist-packages/glanceclient/client.py”, line 59, in Client
module = utils.import_versioned_module(int(version), ‘client’)
File “/usr/local/lib/python2.7/dist-packages/glanceclient/common/utils.py”, line 281, in import_versioned_module
return importutils.import_module(module)
File “/usr/local/lib/python2.7/dist-packages/oslo_utils/importutils.py”, line 73, in import_module
import(import_str)
File “/usr/local/lib/python2.7/dist-packages/glanceclient/v2/init.py”, line 15, in
from glanceclient.v2.client import Client # noqa
File “/usr/local/lib/python2.7/dist-packages/glanceclient/v2/client.py”, line 17, in
from glanceclient.common import http
File “/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py”, line 26, in
ProtocolError = requests.packages.urllib3.exceptions.ProtocolError
AttributeError: ‘module’ object has no attribute ‘packages’
Error fetching image list: ‘module’ object has no attribute ‘packages’

What version of python-glanceclient and requests do you have installed?

glanceclient.version
‘1.2.0’
print requests.version
2.2.1

Seems to have been a glance client bug:

https://bugs.launchpad.net/python-glanceclient/+bug/1526254

You can try ‘pip install -U requests’ which may work around the issue for you until
a new glanceclient is released.

-Dave

Perfect thanks.