python-keystoneclient sets incorrect configuration causing testsuite failure

Bug #1172723 reported by Dirk Mueller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Dolph Mathews

Bug Description

When using an old python-python-memcached version, running the python-keystoneclient testsuite gives:

15:38:36 _StringException: Traceback (most recent call last):
15:38:36 File "/var/lib/python-keystoneclient-test/tests/test_auth_token_middleware.py", line 1011, in test_not_use_cache_from_env
15:38:36 self.middleware._init_cache(env)
15:38:36 File "/var/lib/python-keystoneclient-test/keystoneclient/middleware/auth_token.py", line 366, in _init_cache
15:38:36 self._cache = memorycache.get_client(memcache_servers)
15:38:36 File "/var/lib/python-keystoneclient-test/keystoneclient/openstack/common/memorycache.py", line 47, in get_client
15:38:36 return client_cls(memcached_servers, debug=0)
15:38:36 File "/usr/lib64/python2.6/site-packages/memcache.py", line 168, in __init__
15:38:36 self.set_servers(servers)
15:38:36 File "/usr/lib64/python2.6/site-packages/memcache.py", line 199, in set_servers
15:38:36 self.servers = [_Host(s, self.debug) for s in servers]
15:38:36 File "/usr/lib64/python2.6/site-packages/memcache.py", line 988, in __init__
15:38:36 self.port = int(hostData.get('port', 11211))
15:38:36 TypeError: int() argument must be a string or a number, not 'NoneType'

the problem is caused by

[_Host(s, self.debug) for s in servers]

. The testsuite passes "servers" down as type string, "localhost:11211", which is going trashed here. the documentation in set_servers of python-memcached 1.31 says:

    def set_servers(self, servers):
        """
        Set the pool of servers used by this client.

        @param servers: an array of servers.
        Servers can be passed in two forms:
            1. Strings of the form C{"host:port"}, which implies a default weight of 1.
            2. Tuples of the form C{("host:port", weight)}, where C{weight} is
            an integer weight value.
        """

with other word, the servers parameter needs to be an array, not a string literal.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/27492

Changed in python-keystoneclient:
assignee: nobody → Dirk Mueller (dmllr)
status: New → In Progress
Changed in python-keystoneclient:
assignee: Dirk Mueller (dmllr) → Dolph Mathews (dolph)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/27492
Committed: http://github.com/openstack/python-keystoneclient/commit/40db3fb6ad8bb343c026dd8eaaa4929e8727636a
Submitter: Jenkins
Branch: master

commit 40db3fb6ad8bb343c026dd8eaaa4929e8727636a
Author: Dirk Mueller <email address hidden>
Date: Thu Apr 25 16:11:19 2013 +0200

    Pass memcache_servers as array

    the python-memcached module expects memcache_servers to be an
    array of strings or an array of tuples. Since we don't care about
    server weighting, we can use an array of tuples for the unit test.

    Fixes bug 1172723

    Change-Id: Iafba2bda545ea334d5aba7135e153d8589612ba4

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
milestone: none → 0.2.4
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.