Fix API breakage due to new exceptions module

The commit ae244fcf25 broke API consumers
by moving the OctaviaClientException to a different module. Ensure it
remains available in its previous location by importing it by name.

Change-Id: I35aa0bf105c3b59abb2ff775af12198bc0436572
Story: #2006970
Task: 37698
This commit is contained in:
Zane Bitter 2019-12-02 14:36:30 -05:00 committed by Adam Harwell
parent deaa37820c
commit 400a3a73e0
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,8 @@ from osc_lib import exceptions as osc_exc
from octaviaclient.api import constants as const
from octaviaclient.api import exceptions
OctaviaClientException = exceptions.OctaviaClientException
def correct_return_codes(func):
_status_dict = {400: 'Bad Request', 401: 'Unauthorized',
@ -46,7 +48,7 @@ def correct_return_codes(func):
else:
raise
raise exceptions.OctaviaClientException(
raise OctaviaClientException(
code=code,
message=message,
request_id=request_id)

View File

@ -155,6 +155,12 @@ SINGLE_FVPF_RESP = {'flavorprofile': {'id': FAKE_FVPF, 'name': 'fvpf1'}}
SINGLE_FVPF_UPDATE = {'flavorprofile': {'provider_name': 'fake_provider'}}
class TestAPI(utils.TestCase):
def test_client_exception(self):
self.assertIs(octavia.OctaviaClientException,
exceptions.OctaviaClientException)
class TestOctaviaClient(utils.TestCase):
def setUp(self):