diff --git a/openstack/compute/v2/keypair.py b/openstack/compute/v2/keypair.py index 1db894f81..607aed774 100644 --- a/openstack/compute/v2/keypair.py +++ b/openstack/compute/v2/keypair.py @@ -52,7 +52,11 @@ class Keypair(resource.Resource): @classmethod def list(cls, session, paginated=False, base_path=None): - resp = session.get(cls.base_path, + + if base_path is None: + base_path = cls.base_path + + resp = session.get(base_path, headers={"Accept": "application/json"}) resp = resp.json() resp = resp[cls.resources_key] diff --git a/openstack/compute/v2/server.py b/openstack/compute/v2/server.py index a9db33f9a..32eeec53f 100644 --- a/openstack/compute/v2/server.py +++ b/openstack/compute/v2/server.py @@ -141,7 +141,8 @@ class Server(resource.Resource, metadata.MetadataMixin, resource.TagMixin): def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None): request = super(Server, self)._prepare_request(requires_id=requires_id, - prepend_key=prepend_key) + prepend_key=prepend_key, + base_path=base_path) server_body = request.body[self.resource_key] diff --git a/openstack/compute/v2/server_ip.py b/openstack/compute/v2/server_ip.py index d3b9dd236..710437793 100644 --- a/openstack/compute/v2/server_ip.py +++ b/openstack/compute/v2/server_ip.py @@ -34,7 +34,11 @@ class ServerIP(resource.Resource): @classmethod def list(cls, session, paginated=False, server_id=None, network_label=None, base_path=None, **params): - url = cls.base_path % {"server_id": server_id} + + if base_path is None: + base_path = cls.base_path + + url = base_path % {"server_id": server_id} if network_label is not None: url = utils.urljoin(url, network_label) diff --git a/openstack/database/v1/user.py b/openstack/database/v1/user.py index a18f0b898..b9bd4fe14 100644 --- a/openstack/database/v1/user.py +++ b/openstack/database/v1/user.py @@ -43,7 +43,10 @@ class User(resource.Resource): """ body = {self.resources_key: self._body.dirty} - uri = self.base_path % self._uri.attributes + if base_path is None: + base_path = self.base_path + + uri = base_path % self._uri.attributes uri = utils.urljoin(uri, self.id) return resource._Request(uri, body, None) diff --git a/openstack/identity/v2/extension.py b/openstack/identity/v2/extension.py index 5f95a499d..93f71ad95 100644 --- a/openstack/identity/v2/extension.py +++ b/openstack/identity/v2/extension.py @@ -44,7 +44,11 @@ class Extension(resource.Resource): @classmethod def list(cls, session, paginated=False, base_path=None, **params): - resp = session.get(cls.base_path, + + if base_path is None: + base_path = cls.base_path + + resp = session.get(base_path, params=params) resp = resp.json() for data in resp[cls.resources_key]['values']: diff --git a/openstack/identity/version.py b/openstack/identity/version.py index 710328055..ea1575f81 100644 --- a/openstack/identity/version.py +++ b/openstack/identity/version.py @@ -28,7 +28,11 @@ class Version(resource.Resource): @classmethod def list(cls, session, paginated=False, base_path=None, **params): - resp = session.get(cls.base_path, + + if base_path is None: + base_path = cls.base_path + + resp = session.get(base_path, params=params) resp = resp.json() for data in resp[cls.resources_key]['values']: diff --git a/openstack/message/v2/message.py b/openstack/message/v2/message.py index a8818ace8..8b8d59385 100644 --- a/openstack/message/v2/message.py +++ b/openstack/message/v2/message.py @@ -75,7 +75,11 @@ class Message(resource.Resource): and `X-PROJECT-ID` fields which are required by Zaqar v2 API. """ more_data = True - uri = cls.base_path % params + + if base_path is None: + base_path = cls.base_path + + uri = base_path % params headers = { "Client-ID": params.get('client_id', None) or str(uuid.uuid4()), "X-PROJECT-ID": params.get('project_id', None diff --git a/openstack/message/v2/queue.py b/openstack/message/v2/queue.py index 7b65bb881..7d580e486 100644 --- a/openstack/message/v2/queue.py +++ b/openstack/message/v2/queue.py @@ -75,7 +75,11 @@ class Queue(resource.Resource): """ more_data = True query_params = cls._query_mapping._transpose(params) - uri = cls.base_path % params + + if base_path is None: + base_path = cls.base_path + + uri = base_path % params headers = { "Client-ID": params.get('client_id', None) or str(uuid.uuid4()), "X-PROJECT-ID": params.get('project_id', None diff --git a/openstack/message/v2/subscription.py b/openstack/message/v2/subscription.py index b3960c0fd..3c6322869 100644 --- a/openstack/message/v2/subscription.py +++ b/openstack/message/v2/subscription.py @@ -60,7 +60,8 @@ class Subscription(resource.Resource): def create(self, session, prepend_key=True, base_path=None): request = self._prepare_request(requires_id=False, - prepend_key=prepend_key) + prepend_key=prepend_key, + base_path=base_path) headers = { "Client-ID": self.client_id or str(uuid.uuid4()), "X-PROJECT-ID": self.project_id or session.get_project_id() @@ -81,7 +82,11 @@ class Subscription(resource.Resource): and `X-PROJECT-ID` fields which are required by Zaqar v2 API. """ more_data = True - uri = cls.base_path % params + + if base_path is None: + base_path = cls.base_path + + uri = base_path % params headers = { "Client-ID": params.get('client_id', None) or str(uuid.uuid4()), "X-PROJECT-ID": params.get('project_id', None