summaryrefslogtreecommitdiff
path: root/novaclient/exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated methods and propertiesTakashi NATSUME2019-07-041-36/+0
| | | | | | Remove deprecated methods, properties and unused classes. Change-Id: I16e0b6e55a9c9da04c4582f9be672018d37bf368
* Add support for the 2.57 microversionMatt Riedemann2018-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | With the 2.57 microversion, we: * Deprecate the --file option from the nova boot and nova rebuild CLIs and API bindings. * Add --user-data and --user-data-unset to the nova rebuild CLI and API bindings. * Deprecate the maxPersonality and maxPersonalitySize fields from the nova limits and nova absolute-limits CLIs and API bindings. * Deprecate injected_files, injected_file_content_bytes, and injected_file_path_bytes from the nova quota-show, nova quota-update, nova quota-defaults, nova quota-class-show, and nova quota-class-update CLIs and API bindings. Part of blueprint deprecate-file-injection Change-Id: Id13e3eac3ef87d429454042ac7046e865774ff8e
* Make _console() publichuangtianhua2017-01-181-0/+8
| | | | | | | | | | | | | | | | Heat wants to use 'novaclient.v2.servers. ServerManager._console' method to simplify the implementation of retrieving server console. It's better to change the method to public for public use. The patch changes: 1. add public method named get_console_url() for class 'novaclient.v2.servers.Server' 2. rename _console() to get_console_url() for class 'novaclient.v2.servers.ServerManager' Change-Id: I3d1485468d1d0a79d4002981ebe05b6cdf2332e7 Closes-Bug: #1651677
* Remove support for non-keystone auth systemsMatt Riedemann2016-10-201-9/+0
| | | | | | | | | | | | | | | | | The support for non-keystone auth systems and plugins was deprecated with 1f11840dd84f3570330d1fcd53d1e8eea5ff7922 back in the 3.1.0 release in mitaka. Now that we're working on shoring up the support for keystone auth sessions in the client and eventually moving to remove support for the non-session HTTPClient, we should also remove the support to load non-keystone auth plugins. The whole concept of non-keystone auth systems/plugins is a legacy artifact and is a barrier to interoperability which is a goal of nova and OpenStack in general. Change-Id: Ia649db257c416ca054977812ecb3f1a8044fa584
* Handle error response for webob>=1.6.0Matt Riedemann2016-03-181-3/+15
| | | | | | | | | | | | | | | | | | WebOb change https://github.com/Pylons/webob/pull/230 changed the way in which the error response body is formatted such that it's no longer a nested dict. So we have to handle both the old convention of an error message key to the response body error dict and the new way with just the error body dict. This was reported upstream: https://github.com/Pylons/webob/issues/235 But given this was apparently implemented as a long-overdue change in WebOb the behavior is not likely to change. Change-Id: If653a247d842786d2824b4b3a5c0cde1383ed7ab Closes-Bug: #1559072
* [microversions] Add support for 2.19Andrey Kurilin2016-02-161-0/+18
| | | | | | | | | | | | 2.19 - Allow the user to set and get the server description. The user will be able to set the description when creating, rebuilding, or updating a server, and get the description as part of the server details. Methods `rebuild` and `create` of novaclient.v2.servers.ServerManager were not wrapped with `api_versions.wraps` decorator to reduce code and docsting duplication. Version checks added inside these methods. Change-Id: I75b804c6edd0cdf02c2cd002d0b5968fec8da545
* Make _poll_for_status more user-friendlyAndrey Kurilin2016-02-041-3/+9
| | | | | | | | | | | | | | | | | | | | NOTE: _poll_for_status is a private method, which is used only in shell module, so we can modify it without backward compatibility. _poll_for_status is used for various resources with different interfaces. In case of snapshotting, it works with Image resources, which doesn't have "fault" attribute in "error" state. To prevent AttributeError, we should take this into account. Also, an exception raised by _poll_for_status(InstanceInErrorState) should not be hardcoded for one type of resource, so this exception is renamed to ResourceInErrorState. An exception InstanceInDeletedState, which is also can be raised by _poll_for_status, is not modified, since I don't know cases when it can be used with resources other than Server. Change-Id: Ie0ee96999376cbf608caa1cf8521dbef5c939b52 Closes-Bug: #1538073
* Wrong usage of "a/an"hgangwx2015-12-301-1/+1
| | | | | | | | | | | | | | | | | | | | Wrong usage of "a/an" in the messages: "It will be deprecated after an suitable deprecation" "Delete metadata from an server" "Get a list of actions performed on an server" "based on an requests response" "Get a aggregate by name or ID" Should be: "It will be deprecated after a suitable deprecation" "Delete metadata from a server" "Get a list of actions performed on a server" "based on a requests response" "Get an aggregate by name or ID" Totally 5 occurrences in python-novaclient base code. Change-Id: Iabe764f8b547b39431deb34221266695e0e79fa9
* Migrate to keystoneauth from keystoneclientMonty Taylor2015-12-121-1/+1
| | | | | | | | | | As a stepping stone to the os-client-config patch, first switch to using keystoneauth, its Session and its argparse registration and plugin loading to sort out any issues with that level of plumbing. The next patch will layer on the ability to use os-client-config for argument processing and client construction. Change-Id: Id681e5eb56b47d06000620f7c92c9b0c5f8d4408
* Revert "Do not expose exceptions from requests library"Matt Riedemann2015-10-281-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2961e82bfa6e375ac3c17933fac532ed316ac976 This broke cinder unit tests that have a timeout test for novaclient where they mock the requests library raising a Timeout exception. That test expects to get a requests Timeout passed through but with the change being reverted it was getting a RequestTimeout exception from novaclient, which breaks the test and fails the gate runs. We could change the cinder unit test to handle both the requests.Timeout and the new novaclient RequestTimeout, but that's just papering over the cinder failure, we wouldn't know what other clients are failing in the same way because they have code working around the requests exceptions getting passed through, so we should treat this like an API change. I'd be in favor of making the same change again iff the novaclient exceptions extended the requests exception types so it would be transparent to consumers, since novaclient.exceptions.RequestTimeout would be a requests.Timeout via inheritance. But given the gate breakage and it being summit week I'm inclined to revert first and think about a better long term fix later when people are back to discuss. Change-Id: I368728588e5997eef860a168539eb66c58f2e72a Closes-Bug: #1510790
* Do not expose exceptions from requests libraryJason Dunsmore2015-10-221-0/+23
| | | | | | | | | | | | | | Novaclient expects the requests library to always be able to get a response back and doesn't handle other cases where it might raise an exception even before the request is completed (e.g. ConnectionError). These exceptions should be captured and properly converted to some native novaclient exception. Change-Id: Iec7247b715c38c29910b30e76413cead4e951a37 Co-Authored-By: Kuo-tung Kao <jelly.k@inwinstack.com> Closes-Bug: #1406586
* Add 'deleted' status check in _poll_for_statuswangxiyuan2015-07-281-0/+5
| | | | | | | | | | | | When use command '--poll' to show progress, if the object's staus change into 'deleted' for some reason, it will lead a endless loop.Becasue there is no check about 'deleted' status. For example, when use 'image-create --poll' to create a vm's snapshoot, if glance's quota is small than the snapshoot, the image will be deleted. Change-Id: I028e3064b3371f87873d74494c39255775a2c818 Closes-bug:#1470047
* Implements 'microversions' api type - Part 2Andrey Kurilin2015-07-251-0/+11
| | | | | | | | | | | | | New decorator "novaclient.api_versions.wraps" replaces original method with substitution. This substitution searches for methods which desire specified api version. Also, this patch updates novaclient shell to discover versioned methods and arguments. Related to bp api-microversion-support Co-Authored-By: Alex Xu <hejie.xu@intel.com> Change-Id: I1939c19664e58e2def684380d64c465dc1cfc132
* Implements 'microversions' api type - Part 1Andrey Kurilin2015-07-161-2/+10
| | | | | | | | | | | | | | | | | Compute API version will be transmitted to API side via X-OpenStack-Nova-API-Version header, if minor part of version is presented. New module "novaclient.api_versions" was added as storage for all api versions related functions, classes, variables and etc. `novaclient.api_versions.APIVersion` class is similar to `nova.api.openstack.api_version_request.APIVersionRequest`. The main difference relates to compare methods(method `cmp` is missed from Py3) and processing "latest" version. Related to bp api-microversion-support Change-Id: I0e6574ddaec11fdd053a49adb6b9de9056d0fbac
* Add retry_after only to exceptions supporting itMichal Dulko2014-09-181-12/+19
| | | | | | | | | | | | Having retry_after in HTTP response header for 403 status code caused client to fail with TypeError exception about unexpected keyword argument. This is related to bug in nova-api. To prevent this kind of client problems in the future patch adds check to from_response function to pass retry-after header only to classes that inherit from RetryAfterException and regression unit tests. Change-Id: I6bfc8b33eb591d30b3c647397b11100094718e13 Closes-Bug: 1365251
* Merge "Sync apiclient from oslo-incubator"Jenkins2014-07-251-0/+5
|\
| * Sync apiclient from oslo-incubatorliyingjun2014-06-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Need to sync the latest apiclient from oslo-incubator to make nova cli cache work. Command used: python update.py --base novaclient --dest-dir ../python-novaclient/ \ --modules apiclient syncd patches: apiclient: * 12341ef504 Merge "Restore UUID and human-ID bash completion" * 468afcb335 Merge "Don't slugify names that don't exist" Change-Id: Iec2ad851b47628c5dde4272f438cce4150e11912 Close-bug: 1337033
* | Revert "Reuse exceptions from Oslo"Russell Bryant2014-07-141-15/+159
| | | | | | | | | | | | | | | | | | | | This reverts commit 3bde9c3f427110dae3480644752f49b79ac66ec5. This change is a part of a series that is not backwards compatible. It broke applications using the client library. Change-Id: Id01a0a0feb601539d3855f445ebaf6a3cc000610 Partial-Bug: #1340596
* | Revert "Set default http-based exception as `HttpError`"Russell Bryant2014-07-111-12/+2
|/ | | | | | | | | | This reverts commit 4e1ee661083bd672a884fd13fdb1ffaadea5252a. This change is a part of a series that is not backwards compatible, and caused breakage in applications that use the client library. Change-Id: If614826fb0832602110c1ac8be2c0e6324a5a248 Partial-Bug: #1340596
* Allow us to use keystoneclient's sessionJamie Lennox2014-07-011-0/+10
| | | | | | | | | | | | | The session object is a cross-client means of standardizing the transport layer. Novaclient's HTTPClient object has diverged significantly from other clients. It is easier to simply replace it if a session is provided. If a session is provided then users of the library need to be aware that functions such as authenticate() will no longer have any effect/are in error because this is no longer managed by nova. Change-Id: I8f146b878908239d9b6c1c7d6cdc01c7e124f4e5
* Set default http-based exception as `HttpError`Andrey Kurilin2014-05-221-2/+12
| | | | | | | | | | | | Since exceptions from oslo is used, ClientException doesn't have any attributes related to HTTP, so `HttpError` should be set as default http-based exception. Also, attribute `code` is used in several project, so it should be returned and marked as deprecated. Partial-Bug: #1322183 Change-Id: I3c71e2d25d6e36b5bac0f2b3add74d6747cf7c25
* Reuse exceptions from OsloAndrey Kurilin2014-04-251-159/+15
| | | | | | | | | | | | | | | | | | | | - Remove unused exceptions from novaclient.exceptions - Reuse exceptions from common code OpenStack clients which already use exception from common code: - ironicclient - I784007f36dd6a63fc4c77e0d0f0f000e05eb792f - keystoneclient - Iedf4e5d753d4278d81751ba0f55fdef3566b56de - saharaclient - tuskarclient - Iacbf219168fae62d864c6594dd41e0737e848cfa Similar patches in other clients related to reusing exceptions from common code: - cinderclient - I07f04ba5357e0196fe43b510e1d2fff5afa02faa - glanceclient - I9838391cff7e450f08d27668564b02e63259186c Related to blueprint common-client-library-2 Change-Id: Ia35d65d57a0047f88a609070f8b4c76215cbd3e9
* Merge "Raise exception when poll returns error state"Jenkins2014-04-021-0/+5
|\
| * Raise exception when poll returns error stateRyan Hallisey2014-03-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When running nova boot --poll, any error states that occur will be seen but, an exit code of 0 will be returned indicating success. This would be problematic for scripts looking to see if an operation completed successfully. To fix this, an exception is raised after the nova api indicates to the poll code that the vm is in an error state. The exceptions signals the shell main function to exit with code 1. Change-Id: I48f6b1c82e2f8b221dda898dcb804b0196018505 Fixes-Bug: #1292669
* | Print a useful message for unknown server errorsJohannes Erdfelt2014-03-201-0/+2
|/ | | | | | | | | | | | | If a server error is returned that has an unknown code, novaclient will end up printing something similar to: ClientException: <attribute 'message' of 'exceptions.BaseException' objects> Setting a message for ClientException will ensure that something more useful than that is printed. Change-Id: I43a2a33017f9a5c1b79d7fd8af4153e91d296f7b Closes-bug: 1295293
* Remove None for dict.get()zhang-jinnan2014-02-191-2/+2
| | | | | | Because If no default value is specified it defaults to None already. Change-Id: I3caad9f17840347e30465c7bd4c9c4fe53d991e3
* Enables H403 pep8 rulesSushil Kumar2013-12-141-2/+4
| | | | | | | | Updates tox.ini to reduce ignored rules. Updates code for H403 violation. Change-Id: Iee7b34a27c62ce8cb0f26166b3c16e3386e2fecd
* Enable hacking check for Apache 2.0 licenseChris Yeoh2013-12-061-0/+13
| | | | | | | | | Removes H102 (license header not found) check from flake8 ignore list. Adds missing apache license headers. Change-Id: I109f23c6d8b2e3efb1dac7f764bd77e0d9d335f0
* py33: 'dict_keys' object does not support indexingKui Shi2013-09-221-1/+1
| | | | | | | | | | | | In python 3, dict.keys() is a class of 'dict_keys', it does not support indexing. Cast the dict to list to get the "first" value of dict, which is compatible with python 2&3. Closes-Bug: #1229005 Change-Id: I561b7ada9e5ad936659a657b3161a9b93a15a788
* recognize 429 as an rate limiting statusJiajun Liu2013-07-171-1/+10
| | | | | | | | | currently novaclient recognize 413 as rate limiting status while it shoule be 429 according to HTTP protocol. fixes bug 1191874 Change-Id: Ib1ae54f7d13d0ca579dd264e8d0d7630770e92d6
* Add MethodNotAllowed and Conflict exception classesBrian Waldon2013-05-261-2/+19
| | | | | | | | It is expected to recieve a 405 or a 409 from Nova, but novaclient presents them as a generic ClientException. This patch adds MethodNotAllowed and Conflict classes to represent these HTTP responses. Change-Id: If89cee04ebd74daaa28ea30b5c57cdc63edc1551
* Expose retry_after attribute of OverLimit exceptionBrian Waldon2013-04-291-0/+11
| | | | | | Fixes bug 1174469 Change-Id: Ic1e67f6f91d4fe2072ff68dfb36330cd86c1d5b4
* Clean up exceptions.from_responseBrian Waldon2013-04-291-9/+16
| | | | Change-Id: I359a911c0813697f091517de493be403e8c1d8a3
* ClientExceptions should include url and methodSean McCully2013-01-231-4/+8
| | | | | | | | | | Fixes Bug 1103557. novaclient abstracts out http request from user/client making it unknown to user what root cause behind nova client exceptions being raised. By including url and method in exception handling, this allows user to handle accordingly. Change-Id: I1a509bb932b3fd029bd0870ab699a39e21da19bb
* Use requests module for HTTP/HTTPSDean Troyer2012-12-201-8/+11
| | | | | | | | | | | | | * Implement correct certificate verification * Add --os-cacert * Rework tests for requests Pinned requests module to < 1.0 as 1.0.2 is now current in pipi as of 17Dec2012. Blueprint: tls-verify Change-Id: I9a25a94c8dfcaf483c4c8328439809d65cf10b38
* Add ConnectionRefused exception.Andrew Laski2012-09-071-0/+11
| | | | | | | | | | | When novaclient gets a Connection Refused it now presents that as a ConnectionRefused exception with appropriate information rather than as an HTTP exception. Addresses bug 1047078. vagrant@precise64:/opt/stack/python-novaclient$ nova image-list ERROR: ConnectionRefused: '[Errno 111] Connection refused' Change-Id: Iebf4d78a524004d5e79d2219b35f90fbd38ee690
* Allow different auth providers via plugin system.Chmouel Boudjnah2012-08-061-0/+9
| | | | | | | | | | | | - Remove the NOVA_RAX_AUTH hack and provide (temporary) compatibility with the new system. - Example plugin for RAX and HP provided here : RAX - https://github.com/emonty/rackspace-auth-openstack HP - https://github.com/emonty/hpcloud-auth-openstack - Plugin are allowed to specify their own auth_url directly. - Thanks to mtaylor for helping on this. Change-Id: Ie96835be617c6a20d9c3fc3bd1536083aecfdc0b
* Display the request id on error response.Alex Meade2012-04-111-4/+11
| | | | | | | This changes displays the request id when an error code is returned from the API. Change-Id: I70621fe7477a4612334af32e83f3ee8c5340371d
* Request ID when name is ambiguous.Rick Harris2012-04-091-0/+4
| | | | | | Fixes bug 931605 Change-Id: If0778915d964995dbb6647d56ed21075aec08baa
* Handle Ambiguous Endpoints CorrectlyZiad Sawalha2012-01-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added --service_name argument to allow selecting endpoints by service name - Renamed endpoint_name argument to endpoint_type (this breaks compatibility) - Return AmbiguousEndpoints error if more than one endpoint matches filter - Also addresses bug 924052 Use case: $ nova --projectid xxx --version 1.1 --password xxx --username xxx --url https://identity.openstackcloud.com/ image-list Found more than one valid endpoint. Use a more restrictive filter AmbiguousEndpoints: [ {'serviceName': 'New Cloud', 'region': 'Test', 'publicURL': 'https://test.openstackcloud.com/v1.1/tttt', 'tenantId': 'tttt'}, {'serviceName': 'Old Cloud', 'publicURL': 'https://servers.openstackcloud.com/v1.0/tttt', 'tenantId': 'tttt'}] $ nova --projectid tttt --version 1.1 --password xxx --username xxx --url https://identity.openstackcloud.com/ --service_name 'New Cloud' image-list +--------------------------------------+-----------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+-----------------------------+--------+--------+ | 346f4039-a81e-4444-9223-4a3d13592a07 | Debian Squeeze (6.0) | ACTIVE | | | ac8985ea-c09e-4544-82af-eb459a02a6b2 | Fedora 15 | ACTIVE | | | ddddc02e-92fa-4f44-b36f-55b39bf66a67 | CentOS 5.6 | ACTIVE | | +--------------------------------------+-----------------------------+--------+--------+ Change-Id: I9a10b9ad5e5b9cf6e762659013496a93a79774db
* Abstract Client building into novaclient.clientBrian Waldon2011-12-291-0/+6
| | | | | | | This prevents clients of the pythonic api from having to know the internal module structure. Change-Id: Idd5c522ac3ff6c2d7915f96ed327323ec83d54fc
* new service catalog implementation.Sandy Walsh2011-09-261-0/+5
|
* proxy token support - no testsSandy Walsh2011-09-091-0/+6
|
* removing extra newlineBrian Waldon2011-08-101-1/+0
|
* catching authorization failure (x-server-management-url KeyError)Brian Waldon2011-08-101-0/+5
|
* Tests working again...merged in some work we did earlier.Brian Lamar2011-08-031-0/+105
|
* Split everything down the middle into v1_0 and v1_1, including tests.Brian Lamar2011-08-031-100/+0
|
* Added Jacob Kaplan-Moss copyright notices on older/untouched files.Sandy Walsh2011-02-251-0/+1
|
* renamed to novaclient and fixed flavor testsSandy Walsh2011-02-261-0/+99