python3: Fix traceback while running tests

Fix:

TypeError: Unicode-objects must be encoded before hashing

while running tests. This is due to the fact in python3 hashlib.md5
works with bytes and we are passing unicode strings.

Change-Id: I27a57d6afb2412e11bc2802e4559d56c5b5592a9
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2013-08-09 15:15:04 +00:00
parent 23ac42a43f
commit 8dbd684a5c
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,8 @@ class Manager(utils.HookableMixin):
# pair
username = utils.env('OS_USERNAME', 'NOVA_USERNAME')
url = utils.env('OS_URL', 'NOVA_URL')
uniqifier = hashlib.md5(username + url).hexdigest()
uniqifier = hashlib.md5(username.encode('utf-8') +
url.encode('utf-8')).hexdigest()
cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier))