23 Commits

Author SHA1 Message Date
Sushil Kumar
953734d727 Enables H403 pep8 rules
Updates tox.ini to reduce ignored rules.

Updates code for H403 violation.

Change-Id: Iee7b34a27c62ce8cb0f26166b3c16e3386e2fecd
2013-12-14 15:16:20 +00:00
Chris Yeoh
50685437ed Enable hacking check for Apache 2.0 license
Removes H102 (license header not found) check from flake8
ignore list.

Adds missing apache license headers.

Change-Id: I109f23c6d8b2e3efb1dac7f764bd77e0d9d335f0
2013-12-06 10:47:41 +10:30
Kui Shi
f1c3b79c2b py33: 'dict_keys' object does not support indexing
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
2013-09-22 23:55:46 +08:00
Jiajun Liu
1b5ed91650 recognize 429 as an rate limiting status
currently novaclient recognize 413 as rate limiting status while
it shoule be 429 according to HTTP protocol.

fixes bug 1191874

Change-Id: Ib1ae54f7d13d0ca579dd264e8d0d7630770e92d6
2013-07-17 02:32:29 +00:00
Brian Waldon
f2559c4c39 Add MethodNotAllowed and Conflict exception classes
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
2013-05-26 08:14:32 -07:00
Brian Waldon
eae3d724c0 Expose retry_after attribute of OverLimit exception
Fixes bug 1174469

Change-Id: Ic1e67f6f91d4fe2072ff68dfb36330cd86c1d5b4
2013-04-29 13:47:57 -07:00
Brian Waldon
201b74b6cc Clean up exceptions.from_response
Change-Id: I359a911c0813697f091517de493be403e8c1d8a3
2013-04-29 11:33:32 -07:00
Sean McCully
0614ae75f6 ClientExceptions should include url and method
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
2013-01-23 11:33:42 -06:00
Dean Troyer
aa1df04bad Use requests module for HTTP/HTTPS
* 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
2012-12-20 13:04:46 -06:00
Andrew Laski
8cff1a20bc Add ConnectionRefused exception.
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
2012-09-07 16:04:54 -04:00
Chmouel Boudjnah
86c713b17a Allow different auth providers via plugin system.
- 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
2012-08-06 09:10:00 +02:00
Alex Meade
1602966185 Display the request id on error response.
This changes displays the request id when an error code is returned
from the API.

Change-Id: I70621fe7477a4612334af32e83f3ee8c5340371d
2012-04-11 15:00:49 -04:00
Rick Harris
0028eb4ac2 Request ID when name is ambiguous.
Fixes bug 931605

Change-Id: If0778915d964995dbb6647d56ed21075aec08baa
2012-04-09 21:13:57 +00:00
Ziad Sawalha
38bc7ea570 Handle Ambiguous Endpoints Correctly
- 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
2012-01-31 18:37:36 -06:00
Brian Waldon
e0174b51bd Abstract Client building into novaclient.client
This prevents clients of the pythonic api from having to know the
internal module structure.

Change-Id: Idd5c522ac3ff6c2d7915f96ed327323ec83d54fc
2011-12-29 15:40:49 -05:00
Sandy Walsh
8491c76027 new service catalog implementation. 2011-09-26 12:28:43 -07:00
Sandy Walsh
2c3a865f6b proxy token support - no tests 2011-09-09 06:33:38 -07:00
Brian Waldon
f6273ba08d removing extra newline 2011-08-10 13:30:33 -04:00
Brian Waldon
1f7605cb7e catching authorization failure (x-server-management-url KeyError) 2011-08-10 13:25:17 -04:00
Brian Lamar
454daa2cba Tests working again...merged in some work we did earlier. 2011-08-03 17:41:33 -04:00
Brian Lamar
f8496672cc Split everything down the middle into v1_0 and v1_1, including tests. 2011-08-03 16:36:03 -04:00
Sandy Walsh
8e615f4446 Added Jacob Kaplan-Moss copyright notices on older/untouched files. 2011-02-25 02:00:13 -08:00
Sandy Walsh
bd18c7e429 renamed to novaclient and fixed flavor tests 2011-02-26 05:04:40 -04:00