summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/common.py9
-rw-r--r--nova/api/openstack/views/flavors.py2
-rw-r--r--nova/api/openstack/views/images.py2
-rw-r--r--nova/api/openstack/views/servers.py2
4 files changed, 11 insertions, 4 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index 8794bca6d..48773291c 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -135,5 +135,12 @@ def get_id_from_href(href):
LOG.debug(_("Error extracting id from href: %s") % href)
raise webob.exc.HTTPBadRequest(_('could not parse id from href'))
-def remove_version(base_url):
+
+def remove_version_from_href(base_url):
+ """Removes the api version from the href.
+
+ Given: 'http://www.nova.com/v1.1/123'
+ Returns: 'http://www.nova.com/123'
+
+ """
return base_url.rsplit('/', 1).pop(0)
diff --git a/nova/api/openstack/views/flavors.py b/nova/api/openstack/views/flavors.py
index d967c2af0..d2f7e3e56 100644
--- a/nova/api/openstack/views/flavors.py
+++ b/nova/api/openstack/views/flavors.py
@@ -92,5 +92,5 @@ class ViewBuilderV11(ViewBuilder):
def generate_bookmark(self, flavor_id):
"""Create an url that refers to a specific flavor id."""
- return "%s/flavors/%s" % (common.remove_version(self.base_url),
+ return "%s/flavors/%s" % (common.remove_version_from_href(self.base_url),
flavor_id)
diff --git a/nova/api/openstack/views/images.py b/nova/api/openstack/views/images.py
index 9d6722326..005341c62 100644
--- a/nova/api/openstack/views/images.py
+++ b/nova/api/openstack/views/images.py
@@ -124,5 +124,5 @@ class ViewBuilderV11(ViewBuilder):
def generate_bookmark(self, image_id):
"""Create an url that refers to a specific flavor id."""
- return os.path.join(common.remove_version(self._url),
+ return os.path.join(common.remove_version_from_href(self._url),
"images", str(image_id))
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index b85fceb19..67fb6a84e 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -177,5 +177,5 @@ class ViewBuilderV11(ViewBuilder):
def generate_bookmark(self, server_id):
"""Create an url that refers to a specific flavor id."""
- return os.path.join(common.remove_version(self.base_url),
+ return os.path.join(common.remove_version_from_href(self.base_url),
"servers", str(server_id))