Skip to content

Commit

Permalink
Use endpoint_override in version negotiation
Browse files Browse the repository at this point in the history
Change [1] introduced the usage of endpoint_filter when deciding which
endpoint to use during version negotiation. This requires properly
setting interface/region/service_type in order to properly pick the
endpoint. But, sometimes (for example in Kolla-ansible), the endpoint
url is explicitly defined. In the event of the endpoint being explicitly
defined, it should take priority here.

It should be noted that even though SessionClient extends from
keystoneauth1's adapter.LegacyJsonAdapter, the `request` function within
_make_simple_request is being called on the nested Session object, not
the Adapter itself. If it was called on the Adapter this problem
wouldn't exist, as the `endpoint_override` (or `endpoint`) kwarg passed
in to the constructor of the SessionClient would already take
precedence.

Additionally: Adds a release note to the older branch as this is a
fix that needs to be released and is worthy of change visibility
in release notes.

[1]: I42b66daea1f4397273a3f4eb1638abafb3bb28ce

Change-Id: I69dc2c88648ba1d09a9ad3ab3435662e8d1ea6ff
Related-Bug: #1818295
(cherry picked from commit 8071d5d)
(cherry picked from commit b40630f)
  • Loading branch information
Jason authored and juliakreger committed Apr 17, 2019
1 parent e81f745 commit 466be3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ironicclient/common/http.py
Expand Up @@ -620,7 +620,8 @@ def _make_simple_request(self, conn, method, url):
# NOTE: conn is self.session for this class
return conn.request(url, method, raise_exc=False,
user_agent=USER_AGENT,
endpoint_filter=endpoint_filter)
endpoint_filter=endpoint_filter,
endpoint_override=self.endpoint_override)

@with_retries
def _http_request(self, url, method, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions ironicclient/tests/unit/common/test_http.py
Expand Up @@ -741,6 +741,7 @@ def test_make_simple_request(self):
'service_type': 'baremetal',
'region_name': ''
},
endpoint_override='http://127.0.0.1',
user_agent=http.USER_AGENT)
self.assertEqual(res, session.request.return_value)

Expand Down
@@ -0,0 +1,7 @@
---
fixes:
- |
Fixes an issue where an endpoint_override was not considered when
performing version negotiation, which would can result in the client
attempting to base version negotiation off of an entry in the service
catalog as opposed to an endpoint_override.

0 comments on commit 466be3b

Please sign in to comment.