Commit Graph

518 Commits

Author SHA1 Message Date
Corey Bryant 1b93adc8fb Account for dictionary order in test_shell.py
Change-Id: Id15f3d642e8fcbd663f12b32f52b6014e32574a5
Closes-Bug: 1468485
2015-06-29 10:22:13 -04:00
Jenkins cc38f51086 Merge "Add v2 support for the marker attribute" 2015-06-22 04:52:27 +00:00
Brad Pokorny ea01f13be2 Add v2 support for the marker attribute
The v2 Glance client implementation ignores the marker attribute if
it's passed to the client as part of the kwargs.  Include support
for the attribute, as the v1 client supports it and it makes it
easier to work with the Glance client.

Change-Id: Ifaa59129bc4178212b890ea591673cb154e0f110
Closes-bug: 1465373
2015-06-19 15:03:37 -07:00
Cindy Pallares 997c12d3ab Import only modules and update tox.ini
As stated in the OpenStack Hacking Guidelines, it is prefered
that only modules should be imported.

Also updated tox.ini to ignore opestack/common among others.

Change-Id: I2f0a603c31052eadee581c11880c0ec6bd392829
2015-06-17 10:56:37 -05:00
Jenkins 71d8528364 Merge "Close iterables at the end of iteration" 2015-06-16 19:01:18 +00:00
Jenkins 0d22e821f9 Merge "Add parameter 'changes-since' for image-list of v1" 2015-06-15 18:11:27 +00:00
Jenkins e863cb3f94 Merge "cleanup openstack-common.conf and sync updated files" 2015-06-14 20:09:05 +00:00
Robert Collins 43621dc1ac Close iterables at the end of iteration
This fixes a bug where if iteration is interrupted, we're stuck until
the iterable is garbage collected, which can be a very long time (e.g. if
the iterable is held in an exception stack frame).

Co-authored-by: Stuart McLaren <stuart.mclaren@hp.com>

Change-Id: Ibe9990e8c337c117a978b1cd8ec388c4bc6d3b4b
Closes-bug: 1461678
2015-06-11 18:11:39 +00:00
Jamie Lennox 5ce9c7dc96 Make glanceclient accept a session object
To make this work we create a different HTTPClient that extends the
basic keystoneclient Adapter. The Adapter is a standard set of
parameters that all clients should know how to use like region_name and
user_agent. We extend this with the glance specific response
manipulation like loading and sending iterables.

Implements: bp session-objects
Change-Id: Ie8eb4bbf7d1a037099a6d4b272cab70525fbfc85
2015-06-11 13:11:56 +00:00
Davanum Srinivas 5e85d61fb9 cleanup openstack-common.conf and sync updated files
periodic updates of latest from oslo-incubator. please
note that files no longer on oslo-incubator mean that
they have been moved to oslo.* libraries. So there's
more work needed to remove these files and switch
to appropriate libraries

Change-Id: Icd71b4b1ea9f1df526614a29277f25a7ab47b721
2015-06-10 11:59:12 +00:00
Jenkins d80c70e58a Merge "Improve import related error handling" 2015-05-26 18:20:16 +00:00
Jenkins 064822181a Merge "Fix Metadef Object update issue with python-glanceclient" 2015-05-26 14:59:51 +00:00
Jenkins 85078098e7 Merge "Use assertIn instead of assertTrue in tests" 2015-05-26 09:55:18 +00:00
Jenkins 0bf3bfe94f Merge "Unorder compare in tests" 2015-05-26 01:29:03 +00:00
Jenkins 2eb5292e9d Merge "Include owner and status option in v2 image list" 2015-05-25 21:15:12 +00:00
Jenkins 0c244b24bd Merge "Check image-download for redirection" 2015-05-25 21:15:09 +00:00
Cindy Pallares 6cb26fc2bf Include owner and status option in v2 image list
Show the owner and status information when adding -v or --verbose
to the image-list command.

Closes-bug: #1381514
Change-Id: I90bf622147b12ed157072fad0823af58223caf91
2015-05-22 01:56:42 -05:00
Lakshmi N Sampath 5d933b0dd5 Fix Metadef Object update issue with python-glanceclient
Disallowed fields(schema, created_at and updated_at) were
getting deleted from Metadef namespace instead of Metadef object.

Change-Id: Id80e204c7af1ac6926c66627d290a15c4e6b00d9
Closes-Bug: #1433884
2015-05-18 13:49:52 +02:00
Stuart McLaren 9f5c58193b Fix functional tests in gate
The check-glanceclient-dsvm-functional gate job was failing due to the
functional tests not picking up valid OpenStack credentials.

Update how we aquire credentials -- fixes side effect of how tox 2.0
handles environment variables.

Change-Id: Ia665dc9673d09421508476d05039d2da8a5e1a29
Closes-bug: 1455102
2015-05-15 13:18:00 -04:00
Jenkins 688f902305 Merge "Do not crash on homedir mkdir" 2015-05-14 19:14:38 +00:00
Thomas Goirand 1686d6aa53 Do not crash on homedir mkdir
Glanceclient is trying to create ~/.glanceclient, and crashes if it can't
do that. In some environment (for example, when building the package
under Jenkins), writing on $HOME is simply not allowed, and Glanceclient
can simply ignore it. This patch allows the mkdir() to fail, which fixes
the issue.

Closes-Bug: #1446096
Change-Id: Ib3591fb4e54ccd2fe63a1a4815551ac10ef5b961
2015-05-14 15:41:24 +00:00
Stuart McLaren 1f89beb609 Improve import related error handling
If there was a problem importing a library we would incorrectly raise
an unsupported version error:

  $ glance --os-image-api-version 1 image-list
  "1" is not a supported API version. Example values are "1" or "2".

We should change this to provide information on the failed import, eg:

  $ glance --os-image-api-version 1 image-list
  No module named badimport

We also now raise the full stacktrace in this case if '--debug' is passed
on the command line.

Change-Id: I1c687ae6c5da239090b0b7a4a855b3271a9076da
Related-bug: 1402632
2015-05-08 12:51:02 +00:00
Fei Long Wang 116fac8ae8 Add parameter 'changes-since' for image-list of v1
Now Glance /images/detail API of v1 supports parameter
'changes-since' to query deleted images. But it's missed
in client. This patch will add the parameter.

Related-Bug: #1432701

Change-Id: Id38e3a78b4b2ef680ea04d35e32beb4b9c8efa00
2015-05-06 14:58:44 +12:00
Cindy Pallares 583adc34f8 Check image-download for redirection
Currently when you download an image without specifying
a file or redirecting the output, the image is dumped into
the console as gibberish. We can avoid this if we
check if file is being redirected or if a file is specified.

Change-Id: I257760752f05b82b935cf19fb10573ee7ff1395d
2015-05-05 13:17:39 -05:00
Louis Taylor 9c172fb056 Add some basic CLI functional tests
This ports over most of the functional glanceclient cli tests out from
tempest.

Change-Id: I59d409ade72c289ed9942ce374cae732a40518aa
2015-05-01 17:03:40 +00:00
Kamil Rykowski bf413a6539 Use assertIn instead of assertTrue in tests
Since `assertIn` is provided for checking if value exists in given
container, it is not formal to use `assertTrue` for it.

Change-Id: Ie1392839b5ca436957463bb29f2784d48cfcbf75
2015-04-29 10:31:22 +02:00
Jamie Lennox 6431fae545 Unorder compare in tests
On occassion the values from schema are presented in a different order.
Compare them in an unordered way as we only care that both are present.

Change-Id: Ib2d44587196f43c73f4b0a3796fac9f4dc20f20f
2015-04-29 04:12:35 +10:00
Stuart McLaren 71d97836f8 Create functional test base
This will allow adding 'check-glanceclient-dsvm-functional' tests in
the gate, similar to:

 * check-novaclient-dsvm-functional
 * check-keystoneclient-dsvm-functional
 * check-neutronclient-dsvm-functional
 * etc

Change-Id: Id970db52695db7dc53206aa05fe573995b57aa78
2015-04-18 17:43:01 +00:00
Stuart McLaren f2a8a520e7 Move unit tests to standard directory
This patch moves the glanceclient unit tests to the standard directory
(xxxclient/tests/unit) in preparation for adding functional gate tests
'check-glanceclient-dsvm-functional' in the same vein as existing client
tests for other projects, eg:

* check-novaclient-dsvm-functional
* check-keystoneclient-dsvm-functional
* check-neutronclient-dsvm-functional

Change-Id: I29d4b9e3a428c851575ee9afde40d6df583456c4
2015-04-18 17:42:20 +00:00
Jenkins 825c4a5df2 Merge "Correct help messages for image-update command" 2015-04-18 10:00:59 +00:00
Jenkins dfcce08710 Merge "Omit 'locations' as image-create parameter" 2015-04-15 20:49:12 +00:00
Stuart McLaren bd0aa0672e Fix https stack trace on python 3.4 client
When using the client with python 3.4 and no ssl compression the following
stack trace ocurrs:

 TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Closes-bug: 1442883
Related-bug: 1357430
Change-Id: I8e28f0bb1f3e866f11851247ce31470ca8c2af4f
2015-04-11 11:04:23 +00:00
Stuart McLaren c698b4e322 Fix client when using no ssl compression
Since the release of the 0.16.1 client, using the 'no ssl compression'
option, whether on the command line, or via the library -- Nova does this by
default -- a stack trace was generated.

Closes-bug: 1442664
Related-bug: 1357430

Change-Id: I2b8ddcb0a7ae3cfccdfc20d3ba476f3b4f4ec32d
2015-04-11 11:03:54 +00:00
Fei Long Wang c73026634c Omit 'locations' as image-create parameter
Based on current implementation, locations is reserved
attribute, so it should not be a parameter for image
create.

Closes-Bug: #1399778

Change-Id: Ie51e52157e905fdecf736125be0dac87b1a966ec
2015-04-11 00:02:22 +12:00
Jenkins 287bf62261 Merge "Validate tag name when filtering for images" 2015-04-09 13:10:10 +00:00
Jenkins 93569c61de Merge "glance image-show now have --human-readable option" 2015-04-08 13:26:09 +00:00
Jenkins 5b4aef5742 Merge "Creating task with invalid property crashes in py3" 2015-04-07 13:30:04 +00:00
Jenkins c634c5149c Merge "Expose 'is_base' schema property attribute" 2015-04-02 15:38:24 +00:00
Kamil Rykowski a6234d1c4e Creating task with invalid property crashes in py3
Currently when you are trying to set invalid additional property for
task using py3 interpreter it will fail, because function `unicode` does
not exist in py3.

Fix it by replacing `unicode` with `utils.exception_to_str` which is
used in other modules already.

Change-Id: I5897868f801467a2eaa7585b5f2d578cef358426
Closes-Bug: 1439513
2015-04-02 06:15:48 +00:00
Jamie Lennox fd2f989cca Don't accept *args for client
The HTTPClient object that we are passing *args to does not accept any
args. Don't accept them from the main client interface.

Change-Id: I473bb64be95e058375ebd1e55d4bda4168c3c430
2015-03-28 14:22:49 +11:00
Jenkins b3d2c636ec Merge "Use any instead of False in generator" 2015-03-27 23:56:39 +00:00
Alexander Tivelkov 90407d9e47 Expose 'is_base' schema property attribute
Changeset I49255255 has added an 'is_base' attribute for Image Schema
properties, thus allowing to differentiate between base and custom image
properties, but the client hasn't make any use of it.

This patch adds appropriate attribute to SchemaProperty class and a
helper method which allows to validate if the given property is base or
not.

The added helper method (is_base_property) should not be confused with
the existing is_core_property: the latter just checks if the property is
known to the schema, regardless of its being base or not.

Change-Id: I7c397196dad9ae5494ed2f8f3aacef3fc1ce70d8
Partial-Bug: #1323660
2015-03-27 19:03:48 +03:00
Kamil Rykowski 2c08b40bf0 Validate tag name when filtering for images
Right now all invalid tags are skipped when filtering for image list. We
should change this behaviour to raise an exception when invalid tag
value is provided.

Additionally remove misplaced `pass` from one of the tests.

Closes-Bug: 1433962
Change-Id: If5148608a70ee019697ea2dcb84e19a53222d596
2015-03-26 12:42:36 +00:00
Jenkins 15c2e40449 Merge "Generate API documentation" 2015-03-25 05:17:08 +00:00
yatin karel c149a94ee1 glance image-show now have --human-readable option
Added option '--human-readable' to image-show cli which allows users
to display image size in human-readable format.

Change-Id: Ic3452ce4560d3cf90fa7f59f98e5ff42e804f8c9
Closes-Bug: #1434381
2015-03-22 17:26:55 +05:30
Abhishek Talwar 6d864ef65c Correct help messages for image-update command
Currently when you are trying to update the location of an image which
is not in queued status you will get an error from the Glance API. The
help message for --location and --copy-from arguments should be updated
to inform the user that it works only for images in queued status.

Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>

Change-Id: I82b14ffde3f301d7ffef68e984ba4ad2ae0f8b0f
Closes-Bug: #1220809
2015-03-19 10:24:34 +01:00
Yamini Sardana db5d72947c Updated help for v2 member-update api
help message for v2 glance member-update api
now displays the Valid Values of member status
variable.

The valid values are: pending, accepted, rejected

Change-Id: Ibe6f55c933668451b407ed9a19c520c3fbf1912a
Closes-bug: #1420707
2015-03-17 11:45:43 +05:30
Jenkins 6db625f287 Merge "Extend images CLI v2 with new sorting syntax" 2015-03-16 20:12:42 +00:00
Jenkins 82143e26d3 Merge "Add the ability to specify the sort dir for each key" 2015-03-16 20:11:50 +00:00
Jenkins c32a41415d Merge "Adds the ability to sort images with multiple keys" 2015-03-16 20:11:34 +00:00