34 Commits

Author SHA1 Message Date
Jamie Lennox
27f70bbd58 Remove keystoneclient mocks
The majority of the mocks on keystoneclient are not needed. Instead we
use the fixtures that keystoneclient provides to create well formed
responses and use requests_mock to stub out those values when accessed.

This is a closer to real usage pattern and the way that most client
projects are now handling keystoneclient auth.

Change-Id: I294aca1d11c9c5cfb4b82ad16476af4000efee1c
2015-03-28 14:19:52 +11:00
Jenkins
2858645cef Merge "Unit tests covering missing username or password" 2015-03-10 13:22:43 +00:00
Louis Taylor
96871b975b Fix tests failing if keystone is running locally
This mocks out the call to python-keystoneclient's Session.get_token(),
preventing any actual calls being made to a keystone service, running or
not.

Change-Id: I24b0874d8e67b46b7c2294d4ac54efa861561dff
Closes-bug: 1423170
2015-03-02 17:19:16 +00:00
Michal Dulko
b47925eda1 Unit tests covering missing username or password
After fixing message displayed when client is executed without
required environment variables exported (OS_USERNAME, OS_PASSWORD,
OS_PROJECT_NAME, OS_AUTH_URL) regression tests should be added. I've
also fixed an issue causing tests using make_env method to always use
FAKE_V2_ENV, even in ShellTestWithKeystoneV3Auth.

Change-Id: I800c8fa11ee45d19f179bd030426db86a93d9f6a
Closes-Bug: 1419788
Partial-Bug: 1355252
2015-02-09 14:32:17 +01:00
Rakesh H S
96ff6e46c4 Return 130 for keyboard interrupt
When keyboard interrupt is received by glanceclient, the return code as
of now is 1.

But since the client was terminated by an keyboard interrupt, the return
code should be 130. (http://tldp.org/LDP/abs/html/exitcodes.html)
It is useful when people are writing automation test cases and want to
validate based on the return code.

Change-Id: Ia70116ab6f0708a0ce6eeaed07c1e7a56e68c9f4
Closes-Bug: #1373231
2015-02-05 05:08:59 +00:00
Jenkins
7ce1ff9325 Merge "Add os_ prefix to project_domain_name/id" 2015-01-04 10:40:07 +00:00
Flavio Percoco
9829d7b6b9 Don't require version to create Client instance
We currently require a version to always be passed to discover the
client version that should be loaded. However, this information is
commonly present in the URL instead. The current behavior forces
consumers of the library to keep the required version around and/or to
strip it themselves from the URL.

This patch relaxes that requirement by making the version a keyword and
requesting instead an endpoint to be passed. The patch gives priority to
the version in the endpoint and falls back to the keyword if the later is
not present.

Follow-up patches will improve this code making it interact a bit more
with the endpoint's catalog.

Closes-bug: #1395714
Change-Id: I4ada9e724ac4709429e502b5a006604ca0453f61
2014-12-09 14:45:06 +00:00
Oleksii Chuprykov
bd73a5482c Add os_ prefix to project_domain_name/id
Running glance without defining --os-tenant-id and
--os-tenant-name leads to AttributeError. Add os_ prefix
to project_domain_name and project_domain_id because args
object doesn't have them

Closes-Bug: #1384759

Change-Id: Id85569aad538efcf327312d9936bb6463279ce34
2014-12-09 11:34:57 +00:00
Jenkins
3b6754a8cc Merge "Adds tty password entry for glanceclient" 2014-11-25 09:38:15 +00:00
Jenkins
265bb4aa17 Merge "Add bash completion to glance client" 2014-11-20 10:06:53 +00:00
John Trowbridge
751e064761 Adds tty password entry for glanceclient
Added functionality from keystoneclient to fallback to the tty for password
entry if no password is given via the environment or the --os-password option.

Change-Id: I096e81b61d7f499cbda300abdc14430928d18491
Closes-Bug: 1357549
2014-10-23 18:31:36 +00:00
Louis Taylor
1511c86933 Fix the ordering of assertEqual arguments
This keeps testtools happy, since it expects the argument ordering to be
(expected, actual).

Change-Id: I95b41ad7645700ce23b46c7a5700e79008ed08be
Closes-bug: #1277104
2014-09-19 13:00:28 +00:00
Pawel Koniszewski
33dcea81b2 Support for Metadata Definitions Catalog API
API calls and shell commands added in this patch:
- CRUD for metadefs namespaces;
- CRUD for metadefs objects;
- CRUD for metadefs properites;
- CRD for metadefs resource types and resource type associations.

Change-Id: I6d15f749038e8fd24fc651f0b314df5be7c673ef
Implements: blueprint metadata-schema-catalog-support
Co-Authored-By: Facundo Maldonado <facundo.n.maldonado@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
2014-09-03 11:45:57 -06:00
Michal Dulko
12a3a82734 Add bash completion to glance client
Currently glance client does not support command completion.
The intention is to add this functionality to the client

blueprint add-bash-completion

Change-Id: I725dd308118b101e87182acf0cee6dbfd214e0e4
2014-08-22 12:14:10 +02:00
Cindy Pallares
1dfce5301c Remove deprecated commands from shell
Remove all deprecated commands from the shell
since they are no longer used and to keep
the command line menu from looking cluttered.

Closes-bug: #1314218

Change-Id: I66e82872988e3835e4f290f48dfc80538271426c
2014-08-12 05:30:59 -05:00
Jenkins
558ebf7bb7 Merge "Add support for Keystone v3" 2014-08-07 23:49:53 +00:00
Bob Thyne
f15dc6b82f Add support for Keystone v3
This enables glanceclient to authenticate using Keystone v3
API and includes the addition of several new CLI arguments.

DocImpact

Change-Id: I863ba08d312363dc1ce4fc7822fb21ef53df1a4f
2014-08-05 11:05:09 -07:00
AmalaBasha
dbb242b776 Replace old httpclient with requests
This review implements blueprint python-request and replaces the old
http client implementation in favor of a new one based on
python-requests.

Major changes:
* raw_request and json_request removed since everything is now being
  handled by the same method "_request"
* New methods that match HTTP's methods were added:
    - get
    - put
    - post
    - head
    - patch
    - delete
* Content-Type is now being "inferred" based on the data being sent:
    - if it is file-like object it chunks the request
    - if it is a python type not instance of basestring then it'll try
      to serialize it to json
    - Every other case will keep the incoming content-type and will send
      the data as is.
* Glanceclient's HTTPSConnection implementation will be used if
  no-compression flag is set to True.

Co-Author:  Flavio Percoco<flaper87@gmail.com>
Change-Id: I09f70eee3e2777f52ce040296015d41649c2586a
2014-07-10 13:22:05 +05:30
Cyril Roelandt
9b9b647c9d Python 3: do not use __builtin__
Use six.moves.builtins instead, this works with both Python 2 and 3.

Change-Id: I17cdf651edbf7907e2b8b3d6aec9ace8a76b0110
Closes-Bug: 1289107
2014-03-07 04:06:29 +01:00
Jenkins
a9dee7948d Merge "test_shell: remove a deprecated keyword argument" 2014-03-04 18:43:04 +00:00
Cyril Roelandt
ecf2868fb3 test_shell: remove a deprecated keyword argument
The 'version' keyword argument of argparse.ArgumentParser is deprecated. It was
set to 'None' anyway, so just remove it.

Closes-Bug: #1281856
Change-Id: I6e5af0d90e9b1e7a6a60d5183c13299101148442
2014-02-19 01:54:08 +01:00
Alex Gaynor
d465d60867 Replace file with open, which is Python 3 compatible
Change-Id: I471ae9b372f88a508d4654b1a18c6da90397a828
2014-02-13 06:59:18 -08:00
Jenkins
f6c3d4e141 Merge "Replace file.write and os.path.exists by mock" 2014-01-22 03:44:07 +00:00
Noboru arai
869ea2e61c Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I2b37758f9dbb2cad6457a879d4ed7ff0aa69ef8e
Partial-Bug: #1229324
2014-01-14 16:40:22 +00:00
Andrey Kurilin
9a0b7d0450 Replace file.write and os.path.exists by mock
During the test files may be lost in the temporary directory.
Therefore, it would be nice if we reduce dependence of temporary directory.

This patch replace buildin method file.write by mock in ShellCacheSchemaTest.
Also we need to replace method os.path.exists by mock to correct all checks.

Fixes bug: #1267515

Change-Id: I3faca27348e15b28619e49f11d0d6cff5a9e2906
2014-01-10 17:37:00 +02:00
Jenkins
a7c33d5802 Merge "change assertEquals to assertEqual" 2013-11-15 06:33:29 +00:00
Jenkins
9a649d46ea Merge "Replace OpenStack LLC with OpenStack Foundation" 2013-11-15 06:33:28 +00:00
Christian Berendt
7f8292f39d change assertEquals to assertEqual
According to http://docs.python.org/2/library/unittest.html
assertEquals is a deprecated alias of assertEqual.

Change-Id: I22f4702f41537c05684dfacb3f305627b36849c5
2013-10-24 07:54:16 +02:00
Chang Bo Guo
7bf27252e5 Fix misused assertTrue in unit tests
Refactored unit tests to use assertEqual instead of assertTrue
where needed.

Closes-Bug: #1226374

Change-Id: I5f3b582e19f3461a04b5df05960095779ec8aa1a
2013-10-08 19:04:08 -07:00
eddie-sheffield
32d9c42816 Add CLI for V2 image create, update, and upload
Provides command line support for image-create, image-update,
and image-upload using the Glance V2 API. This includes building
help text for create and update based on the image jsonschema
as fetched from the server.

Also fixes bug caused by default warlock patch generation not
matching what Glance expects when updating a core property
which had not originally been set when the image was created.

Related to bp glance-client-v2

Change-Id: I841f9e3d05802f4b794cb6f4849abe03ff0324d9
2013-10-02 13:22:55 -04:00
ZhiQiang Fan
2517203975 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I38dcbcf1a6c8efe540fcf5f29e782cb3826e583d
Fixes-Bug: #1214176
2013-09-20 04:05:51 +08:00
Dazhao
061da46202 Support glance client can get ipv6 image url correctly
This patch is for fix bug 1208784. In openstack ipv6 environment,
if the os image url is not provided, need use the provided host
to generate literal ipv6 image url.

Fixes bug 1208784

Change-Id: Icb71241a639db02d079348f086bd7bd5f0412609
2013-09-06 13:58:24 +08:00
Dirk Mueller
62579fbb21 Start using Pyflakes and Hacking
Instead of globally ignoring pyflakes and
hacking warnings, only blacklist those that trigger
very frequently so far, in order to clean them
up in followup commits. Fix and start gating
on the rest already.

Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
2013-06-22 16:00:26 +02:00
Tatyana Leontovich
8451a94822 Add test for glanceclient shells
Add unittests for the following modules:
* glanceclient.shell
* glanceclient.v1.shell
* glanceclient.v1.legacy_shell
* glanceclient.v2.shell
Also add mock library to the tools/test-requires

Implements: blueprint glanceclient-shells-unittests
Change-Id: I5ec527c5efff3726932d234d7c67e08149643f89
2013-05-17 19:46:07 +03:00