Make osc plugin work again
while moving to SessionClient the OSC plugin was forgotten to be amended accordingly. Besides, the keystoneauth Adapter's request method returns a single response object, not a tuple. This commit also updates relevant requirements to be in sync with global OpenStack ones. Change-Id: I1cd33feec81bafad6237ca72b9c2f410237898b4 Closes-Bug: #1747718
This commit is contained in:
parent
346ade1e35
commit
be4dfa504e
|
@ -37,4 +37,4 @@ class SessionClient(adapter.Adapter):
|
|||
|
||||
if raise_exc and resp.status_code >= 400:
|
||||
raise exceptions.from_response(resp, url, method)
|
||||
return resp
|
||||
return resp, resp.json()
|
||||
|
|
|
@ -145,7 +145,7 @@ def from_response(response, url, method=None):
|
|||
"""Return an instance of one of the ClientException on an requests response.
|
||||
|
||||
Usage::
|
||||
resp, body = requests.request(...)
|
||||
resp = requests.request(...)
|
||||
if resp.status_code != 200:
|
||||
raise exception_from_response(resp)
|
||||
"""
|
||||
|
|
|
@ -42,16 +42,8 @@ def make_client(instance):
|
|||
region_name=instance.region_name,
|
||||
interface=instance.interface,
|
||||
)
|
||||
|
||||
kwargs = {'endpoint': endpoint,
|
||||
'auth_url': instance.auth.auth_url,
|
||||
'region_name': instance.region_name,
|
||||
'username': instance.auth_ref.username}
|
||||
|
||||
if instance.session:
|
||||
kwargs.update(session=instance.session)
|
||||
else:
|
||||
kwargs.update(token=instance.auth_ref.auth_token)
|
||||
kwargs = {'session': instance.session,
|
||||
'endpoint_override': endpoint}
|
||||
|
||||
client = panko_client(**kwargs)
|
||||
|
||||
|
|
|
@ -43,10 +43,7 @@ class TestEventPlugin(base.TestBase):
|
|||
interface=fakes.INTERFACE,
|
||||
)
|
||||
panko_client.assert_called_once_with(
|
||||
endpoint=mock.sentinel.ep,
|
||||
auth_url=fakes.AUTH_URL,
|
||||
region_name=fakes.REGION_NAME,
|
||||
username=fakes.USERNAME,
|
||||
endpoint_override=mock.sentinel.ep,
|
||||
session='fake_session',
|
||||
)
|
||||
|
||||
|
@ -71,9 +68,6 @@ class TestEventPlugin(base.TestBase):
|
|||
interface=fakes.INTERFACE,
|
||||
)
|
||||
panko_client.assert_called_once_with(
|
||||
endpoint=mock.sentinel.ep,
|
||||
auth_url=fakes.AUTH_URL,
|
||||
region_name=fakes.REGION_NAME,
|
||||
username=fakes.USERNAME,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
endpoint_override=mock.sentinel.ep,
|
||||
session=None
|
||||
)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#
|
||||
|
||||
from pankoclient import client
|
||||
from pankoclient.exceptions import ClientException
|
||||
from pankoclient.v2 import capabilities
|
||||
from pankoclient.v2 import events
|
||||
|
||||
|
@ -27,6 +28,8 @@ class Client(object):
|
|||
|
||||
def __init__(self, session=None, service_type='event', **kwargs):
|
||||
"""Initialize a new client for the Panko v2 API."""
|
||||
if session is None:
|
||||
raise ClientException(message='Session is required argument')
|
||||
self.http_client = client.SessionClient(
|
||||
session, service_type=service_type, **kwargs)
|
||||
self.capabilities = capabilities.CapabilitiesManager(self.http_client)
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
keystoneauth1>=2.18.0 # Apache-2.0
|
||||
osc-lib>=1.2.0 # Apache-2.0
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
osc-lib>=1.8.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
oslo.serialization>=1.10.0 # Apache-2.0
|
||||
oslo.utils>=3.18.0 # Apache-2.0
|
||||
pbr>=1.8 # Apache-2.0
|
||||
requests!=2.12.2,>=2.10.0 # Apache-2.0
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
|
|
Loading…
Reference in New Issue