Add InvalidLicense exception
This exception happens when the user's license expires on NSX and
a patch call is made. This is supported with NSX 3.1.0 and beyond
Change-Id: Ifb2dd824128720bd25d0053faab57cbbb6c7f04f
(cherry picked from commit 849d2c0e5a
)
This commit is contained in:
parent
0cbbc2f8a9
commit
e9bf2f88e2
@ -314,6 +314,9 @@ class NsxV3RESTClientTestCase(nsxlib_testcase.NsxClientTestCase):
|
||||
exc = client.http_error_to_exception(500, 607)
|
||||
self.assertEqual(exc, nsxlib_exc.APITransactionAborted)
|
||||
|
||||
exc = client.http_error_to_exception(requests.codes.FORBIDDEN, 505)
|
||||
self.assertEqual(exc, nsxlib_exc.InvalidLicense)
|
||||
|
||||
|
||||
class NsxV3JSONClientTestCase(nsxlib_testcase.NsxClientTestCase):
|
||||
|
||||
|
@ -91,7 +91,8 @@ def http_error_to_exception(status_code, error_code):
|
||||
'607': exceptions.APITransactionAborted},
|
||||
requests.codes.FORBIDDEN:
|
||||
{'98': exceptions.BadXSRFToken,
|
||||
'403': exceptions.InvalidCredentials},
|
||||
'403': exceptions.InvalidCredentials,
|
||||
'505': exceptions.InvalidLicense},
|
||||
requests.codes.TOO_MANY_REQUESTS: exceptions.TooManyRequests,
|
||||
requests.codes.SERVICE_UNAVAILABLE: exceptions.ServiceUnavailable}
|
||||
|
||||
|
@ -155,6 +155,10 @@ class InvalidCredentials(ManagerError):
|
||||
message = _("Failed to authenticate with NSX: %(msg)s")
|
||||
|
||||
|
||||
class InvalidLicense(ManagerError):
|
||||
message = _("No valid License to configure NSX resources: %(msg)s")
|
||||
|
||||
|
||||
class BadJSONWebTokenProviderRequest(NsxLibException):
|
||||
message = _("Bad or expired JSON web token request from provider: %(msg)s")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user