Browse Source

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
changes/47/696947/2
Zane Bitter 2 years ago
committed by Adam Harwell
parent
commit
400a3a73e0
  1. 4
      octaviaclient/api/v2/octavia.py
  2. 6
      octaviaclient/tests/unit/api/test_octavia.py

4
octaviaclient/api/v2/octavia.py

@ -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)

6
octaviaclient/tests/unit/api/test_octavia.py

@ -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):

Loading…
Cancel
Save