summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Pilotti <ap@pilotti.it>2012-11-09 20:03:01 +0200
committerAlessandro Pilotti <ap@pilotti.it>2012-11-09 21:16:05 +0200
commit3757ba9ccf0915d1854c97f625effd0edbedfa12 (patch)
tree551360b6b39dc44ead8af636db3425f750881bfc
parentc6dd816cb6f09cb0148730875f02018b4949e9b6 (diff)
downloadnova-3757ba9ccf0915d1854c97f625effd0edbedfa12.tar.gz
nova-3757ba9ccf0915d1854c97f625effd0edbedfa12.tar.xz
nova-3757ba9ccf0915d1854c97f625effd0edbedfa12.zip
Fixes a bug in api.metadata.base.lookup() on Windows
Fixes Bug #1077125 api.metadata.base.lookup() uses os.path.normpath() to normalize urls. This doesn't work on Windows as it transforms "/" in "\". The fix solves the issue, but os.path.normpath() should never be used to normalize urls. Change-Id: I83d0795d5875acac5fe9bd543f9ca9b4a3e2c8d5
-rw-r--r--nova/api/metadata/base.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/nova/api/metadata/base.py b/nova/api/metadata/base.py
index 469d87d46..6fd8b1374 100644
--- a/nova/api/metadata/base.py
+++ b/nova/api/metadata/base.py
@@ -21,6 +21,7 @@
import base64
import json
import os
+import posixpath
from nova.api.ec2 import ec2utils
from nova import block_device
@@ -314,9 +315,9 @@ class InstanceMetadata():
def lookup(self, path):
if path == "" or path[0] != "/":
- path = os.path.normpath("/" + path)
+ path = posixpath.normpath("/" + path)
else:
- path = os.path.normpath(path)
+ path = posixpath.normpath(path)
# fix up requests, prepending /ec2 to anything that does not match
path_tokens = path.split('/')[1:]