summaryrefslogtreecommitdiff
path: root/neutronclient/common/exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove usage of sixzhanghao2020-05-151-2/+0
| | | | | | | | | | | With python3.x, classes can use 'metaclass=' instead of 'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can be replaced by 'items' and 'keys', 'six.moves.urllib.parse' can be replaced by 'urllib.parse', 'six.StringIO' and 'six.moves.cStringIO' can be replaced by 'io.StringIO', 'six.text_type' and 'six.string_type' are just 'str'. Change-Id: I357968c6a1932856b1600f6c191966bc90cbc258
* Define IpAddressAlreadyAllocated exceptionHongbin Lu2018-01-231-0/+4
| | | | | | | | | | This exception will raise when creating a port with an IP allocated IP address. This exception needs to be defined in client so that nova can catch it and perform the error handling. Needed-By: I5bee9ae18764b6f285ecc5e8d7148a1019c74701 Change-Id: Ie1d4581d334e1ec491e56371c62978945ae24a44 Related-Bug: #1744103
* Decode exception parameters to expand exception message properlyAkihiro Motoki2016-12-151-1/+10
| | | | | | | | | | If a multibyte string without unicode prefix 'u' is passed to NeutronException in python 2, string subsitution will fail. In python 2, multibyte string without 'u' prefix is encoded into bytes. As a result a string substitution in NeutronException.__init__ will fail. Change-Id: I1aa08b69fe119087a7a49fda768a24f85f0e7c76 Closes-Bug: #1235228
* Merge "Use six.python_2_unicode_compatible for NeutronException.__str__"Jenkins2016-09-221-0/+3
|\
| * Use six.python_2_unicode_compatible for NeutronException.__str__Akihiro Motoki2016-01-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | The definition of __str__ is different between py2 and py3. __str__ should return a byte stream to make print(exc) work in python2, but __str__ should return string type in python3. six.python_2_unicode_compatible sets up __str__ and __unicode__ approriately. Change-Id: I6c85ca8c4e6f86450ee390db81e3aa101293b846 Related-Bug: #1235228
* | Add client exception for HostNotCompatibleWithFixedIpsCarl Baldwin2016-07-221-0/+4
| | | | | | | | | | Change-Id: I636ef272202ec7ea8fc0adbfd86ca3eb07e316ba Partially-Implements: blueprint routed-networks Depends-On: I8dc8890907d1e241dd12448fa184cea1b0620663
* | Fix TypeError with error messageRabi Mishra2016-03-041-1/+2
| | | | | | | | | | | | | | | | neutronclient throws type error when dealing with i18n messages. This patch fixes it. Change-Id: I08190eb7f6c54f0d44c671b1806423bba22ac0bf Closes-Bug: #1552760
* | Add wrapper classes for return-request-id-to-callerHirofumi Ichihara2016-02-261-0/+9
|/ | | | | | | | | | | | | | | Added wrapper classes which are inherited from base data types tuple, dict and str. Each of these wrapper classes contain a 'request_ids' attribute which is populated with a 'x-openstack-request-id' received in a header from a response body. This change is required to return 'request_id' from client to log request_id mappings of cross projects[1]. [1]: http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html Change-Id: I55fcba61c4efb308f575e95e154aba23e5dd5245 Implements: blueprint return-request-id-to-caller
* Use _i18n instead of i18nAkihiro Motoki2015-12-241-1/+1
| | | | | | | | | | | | It is suggested to use _i18n.py per oslo.i18n document. http://docs.openstack.org/developer/oslo.i18n/usage.html neutronclient.i18n is now a wrapper module which emits the derecation warning. It is because might be used in implementation of the client extensions in other repositories. Closes-Bug: #1519493 Change-Id: I44969daeedc9a66dd9ad5bf80617516faf245ecc
* Fix H405 violationsshu-mutou2015-12-131-1/+3
| | | | | | | | There are a lot of H405 violation codes. We need to fix the code for avoiding more violations. Change-Id: Iaa83626b81a3d8369b16e2b4f394e2bc4628998a Closes-Bug: #1521899
* Remove unused AlreadyAttachedClientAkihiro Motoki2015-07-131-6/+0
| | | | | | | | | | | | | This is a revert of revert of the original "Remove unused AlreadyAttachedClient" (30b198edec988d7c969c1edd4a2754bd9c9c79f4). The removed exception was referenced in Horizon Icehouse code and Icehouse is now EOL, so we can remove it safely now. This reverts commit d6cfd34e13426b88b40cb6ef7fdcd60d9b7dcb6b. Related-Bug: #1441969 Change-Id: Ic3ef81af3dab0e0aa3d0012c6e642b060488dd62
* Add InvalidIpForSubnetClient exceptionQin Zhao2015-05-111-0/+4
| | | | | | | | | A new Neutron exception type, InvalidIpForSubnetClient, is added by https://review.openstack.org/#/c/121767/ . Need to let Neutron client to identify this new exception type. Change-Id: Ib4f0d7af3807f96463c82d1d2a1e53b56081facc Partial-Bug: 1369871
* Revert "Remove unused AlreadyAttachedClient"Akihiro Motoki2015-04-091-0/+6
| | | | | | | | | | | | The removal of AlreadyAtatchedClient exception from neutronclient suddenly causes the failure of neutronclient icehouse job. It is better to wait the removal of the exception until Icehouse EOL (which will come soon). This reverts commit 30b198edec988d7c969c1edd4a2754bd9c9c79f4. Closes-Bug: #1441969 Change-Id: Ifa02a4ca39bc9c0fe9b65d5b0d66c588885cb12c
* Remove unused AlreadyAttachedClientDoug Fish2015-03-111-6/+0
| | | | | | | This exception is no longer referenced in Horizon. It should be removed as noted in the TODO being removed. Change-Id: I9970ca375d19476c12891475d0a8c0c559e0507f
* Fix mixed usage of _Hideki Saito2014-11-081-1/+1
| | | | | | | | * all modules are using function of _ from oslo.i18n * remove the definition of _ from openstack.common.__init__.py for safety Change-Id: Ice2f8be1190fd13e8991a8c7fa55ca636341e875 Closes-Bug: #1382476
* Add InvalidIpForNetworkClient exceptionQin Zhao2014-10-141-0/+4
| | | | | | | | | | | | | When posting an 'attach interface' request to Nova with an invalid ip for defined network, Nova returns an HTTP 500 error. In fact, Neutron returns 'InvalidInput' error, but Neutron client is not able to translate this error to a specific exception. So that a general 'BadRequest' exception is thrown. Neutron client and Nova need a more specific Neutron error type, in order to address and translate the error in to a proper Nova exception. Change-Id: Idd964c33476d7559f642287d577f8a6122d7674c Partial-Bug: 1369871
* Unify doc-strings formatStanislav Kudriashev2014-08-281-4/+3
| | | | Change-Id: If6cf2caeae294db30a8988ab861441211b651580
* Add MacAddressInUseClient exception handlingMatt Riedemann2014-07-231-0/+4
| | | | | | | | | | | Nova needs a specific client exception defined for the server's MacAddressInUse exception when allocating ports so it can handle the exception properly, otherwise the NeutronClientException with a 409 can be confused with other errors. Partial-Bug: #1347778 Change-Id: Ia02dbc8fe32a43adeb229e3b640b9b33ec0dd6c7
* Merge "Ensure .status_code is defined for all NeutronClientExceptions"Jenkins2014-06-251-0/+2
|\
| * Ensure .status_code is defined for all NeutronClientExceptionsAngus Lees2014-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | nova contains plenty of code like: except neutron_client_exc.NeutronClientException as e: if e.status_code == 409: ... This change declares a fallback of 0 for exceptions without a more explicit status code. This was the behaviour prior to Change-Id I99b9560b3afaf5884fd00353323267da450338fa Change-Id: Ib736205066fd5cd9738fd3fb3b64f6590803cf39
* | Add OverQuotaClient as exception to neutronclientjichenjc2014-05-311-0/+4
|/ | | | | | | | | | | | In nova, there is no way to explictly knows whether the neutron fails due to over quota or no more floating ips and fixed ips. so nova need to check whether the return value is 409 in order to raise an over quota exception. It's easier in neutronclient to raise the exception then nova will handle it. Related-Bug: #1210598 Change-Id: I8788993578ac872da9f676fe3e2fb8f98414289d
* Rearrange neutronclient exceptions for more easy useAkihiro Motoki2014-03-241-72/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | - Map exceptions from neutron server into corresponding client exceptions automatically (without exception mapping dict). An exception from Neutron server 'SomeException' will be mapped to an exception 'SomeExceptionClient' ('Client' suffix) if it is defined. - If no corresponding exception is defined in client side, an exception per response code will be used. Previously NeutronClientException was used for all cases and a user of client library cannot know exception type without checking exception.status_code. It allows client lib users (such as Horizon) to handle exceptions more easily. - All exceptions from client libarry inherit NeutronClientException and all CLI related exceptions inherits NeutronCLIError now. - Remove unused exceptions (including Quantum v1 related) - MalformedRequestBody is renamed to MalformedResponseBody because it is raised in deserializer and deserializer is used to parse not request but response. Closes-Bug: #1296148 Change-Id: I99b9560b3afaf5884fd00353323267da450338fa
* New exception when auth_url is not specifiedDrew Thorstensen2014-03-041-0/+4
| | | | | | | | | | | | | | | | | | | Certain scenarios into the neutron client will not specify the auth_url. This is typically when a token is specified. However, when the token is expired the neutron client will attempt to refresh the token. Users of this may not have passed in all of the required information for this reauthentication to properly occur. This code fixes an error that occurs in this flow where the auth_url (which is None) is appended to another string. This results in a core Python error. The update will provide a more targetted error message specifying to the user that the auth_url needs to be specified. An associated unit test is also included to validate this behavior. Change-Id: I577ce0c009a9a281acdc238d290a22c5e561ff82 Closes-Bug: #1241275
* Remove vi modelinesliu-sheng2014-02-101-2/+0
| | | | | | | | We don't need to have the vi modelines in each source file, it can be set in a user's vimrc if required. Change-Id: Ic30e91df1b0e25beda9b8d8c19be58573cdae4f6 Closes-Bug: #1229324
* Rename Nicira NVP to VMware NSX in neutronclientarmando-migliaccio2014-01-281-1/+1
| | | | | | | | Use new naming scheme to reflect rebranding. Partial-implements blueprint nicira-plugin-renaming Change-Id: I694fbda1c228e92a0b910358523787fa742d9ab2
* Fix i18n messages in neutronclientSergio Cazzolato2013-11-291-2/+2
| | | | | | | | | | | Using tools/check_i18n.py to scan source directory, and fix most of the errors. - Message internationalization - First letter must be capital - Using comma instead of percent in LOG.xxx Partial-Bug: #1217100 Change-Id: I312f999f97e33d84c3f06fa1caacf32affc26a78
* Handle IpAddressInUse with client exceptionMatt Riedemann2013-11-251-0/+4
| | | | | | | | | | | | | | Nova is not able to reliably distinguish between port OverQuota 409 errors and IpAddressInUse 409 errors when setting up networks for instances. The client needs to provide a more granular exception so nova can translate the error to it's own set of exceptions. Also adds a test case for the exception_handler_v20 utility method which was lacking explicit test coverage before this change. Partial-Bug: #1247844 Change-Id: I71589097ae660c3385b3f4ff93ffae99ac7042b9
* Adds ExternalIpAddressExhaustedClient exceptionChris Yeoh2013-09-301-0/+4
| | | | | | | | | | | Adds the ExternalIpAddressExhaustedClient exception so a more specific exception than NeutronClientException is raised when IPs run out. This will allow for better exception handling in Nova. Closes-Bug: 1233143 Change-Id: I9f40bf14eec0f485dfd21b36605a2474b99a8941
* Adds IpAddressGenerationFailureClient exceptionChris Yeoh2013-09-271-0/+4
| | | | | | | | | | Adds the IpAddressGenerationFailureClient exception so a more specific exception than NeutronClientException is raised when IPs run out. This will allow for better exception handling in Nova and help fix nova bug 1212137 Change-Id: I921ba5d5f5ee3dc9620dcdbbd04d6fef824c9a53 Closes-Bug: 1231836
* Handle host side SSL certificates validationRoman Podolyaka2013-07-231-0/+4
| | | | | | | | | | | | | - add --os-cacert option which allows to set a file containing certificates of root CAs (certificate authorities) that are required for validation of HTTPS servers SSL certificates - wrap httplib2 SSL certificates validation errors with a custom quantumclient exception Blueprint: quantum-client-ssl Change-Id: I4e6a7d177ba14314ba9bed613ec2684bffc35222
* raise better exception for duplicate matchAaron Rosen2013-07-161-0/+5
| | | | | | | | | | | When a duplicate match is found the client previously raised a NeutronClientException which made it hard for programs using the client to handle errors. This patch now makes it raise a NeutronClientNoUniqueMatch exception instead. Fixes bug: 1200323 Change-Id: I6ef6f9a9e257104f676dde7ec26be98417ec70e0
* Rename quantumclient to neutronclient2.2.4Mark McClain2013-07-031-0/+169
Implements Blueprint: remove-use-of-quantum Change-Id: Idebe92d56d277435ffd23f292984f9b8b8fdb2df