672 Commits

Author SHA1 Message Date
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
Mike Fedosin
3f3066be97 Extend images CLI v2 with new sorting syntax
This code enables new syntax for sorting output with multiple
keys and directions based on API Working group sorting
guidelines.

It's a client code to consume API modified in change
Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb

Example:
glance --os-image-api-version 2 --sort name:desc,size:asc

Implements-blueprint: glance-sorting-enhancements
DocImpact
Depends-On: Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb
Change-Id: I36a9fa9f0508fea1235de2ac3a0d6a093e1af635
2015-03-16 19:31:49 +03:00
Jenkins
7c54b14cf0 Merge "Apply expected patch format when updating tags in v2.images" 2015-03-16 16:24:16 +00:00
Mike Fedosin
bbd27d5276 Add the ability to specify the sort dir for each key
Adds client code to consume API modified in change
Ib43b53abfba7cb5789d916a014376cf38fc5245b

Extends CLI for v2 with multiple sort dirs
Example:
glance --os-image-api-version 2 image-list \
--sort-key name --sort-dir asc --sort-key size --sort-dir desc

Implements-blueprint: glance-sorting-enhancements
DocImpact
Depends-On: Ib43b53abfba7cb5789d916a014376cf38fc5245b
Change-Id: Ia20716f3c75299f796879299da317b2e81496088
2015-03-16 14:29:06 +03:00
Jimmy McCrory
976fe1776b Import sys module
This module is required by the _is_image_data_provided function.

Change-Id: I78265209a2f80aaf61bbe25d69e79c939182516c
Closes-Bug: 1432249
2015-03-14 14:32:40 -07:00
Mike Fedosin
fc79467ff6 Adds the ability to sort images with multiple keys
Adds client code to consume API modified in change
Ib7a6aeb2df3bc5d23fe8e070290b5bfcab00c0f5

Extends CLI for v2 with multiple sort keys
Example:
glance --os-image-api-version 2 image-list --sort-key name --sort-key size

Implements-blueprint: glance-sorting-enhancements
Change-Id: If79779a4c52c8dc5c4f39192d3d247335a76ba24
DocImpact
Closes-Bug: 1221274
2015-03-13 18:35:00 +03:00
Steve Lewis
f6f573316c Apply expected patch format when updating tags in v2.images
Currently, glanceclient.v2.update builds a patch request that does not
match glance API.

This patch overrides the default behaviour to customize the patch
request with the right format for the API.

Co-Authored-By: Steve Lewis <steve.lewis@rackspace.com>
Fixes bug 1306774
Change-Id: If0739ac285da1e741bfa40b6c719331a5ce49319
2015-03-12 15:18:20 -07:00
Jenkins
cc4c402f09 Merge "Fix leaking sockets after v1 list operation" 2015-03-11 15:02:22 +00:00
Jenkins
3e207dc065 Merge "Fix minor typo in version error message" 2015-03-11 03:12:33 +00:00
Jenkins
2858645cef Merge "Unit tests covering missing username or password" 2015-03-10 13:22:43 +00:00
Jenkins
9e09211914 Merge "Remove duplicate 'a' in the help string of --os-image-url" 2015-03-10 11:50:53 +00:00
Jenkins
23c8d1818a Merge "v2: read limit for list from --limit in shell" 2015-03-06 22:38:24 +00:00
Jenkins
f32e827b37 Merge "Fix leaking sockets after v2 list operation" 2015-03-06 22:37:27 +00:00
Jenkins
c7c4ac9e85 Merge "v2: Allow upload from stdin on image-create" 2015-03-06 19:55:15 +00:00
Jenkins
8eaf97d42e Merge "Fix v2 image create --file documentation" 2015-03-06 19:49:13 +00:00
Louis Taylor
a9a692b351 v2: read limit for list from --limit in shell
Previously this was read from the --page-size argument, which lead to
incorrect behaviour.

Change-Id: I08ecda95eca0ff524e28a1d5371ce6c73dfc548e
Closes-Bug: #1429088
2015-03-06 13:18:11 +00:00
Louis Taylor
0ab5a78d78 Fix leaking sockets after v2 list operation
This fixes the same problem with leaking file descriptors after the port
to requests I16a7b02f2b10e506e91719712cf34ef0aea1afc0 does, but for the
v2 api client.

The paginate function in the list method has been refactored from a
recursive generator to a non-recursive generator, which avoids issues
with garbage collection holding the socket open.

Change-Id: Iaa7a421e8c1acafb7b23bb3f55e50b9d2a9d030a
Closes-Bug: #1428797
2015-03-05 18:53:54 +00:00
Jenkins
59eec058bc Merge "removed excessive call to os.path.exists" 2015-03-05 14:44:58 +00:00
Louis Taylor
f98ab688ef Fix leaking sockets after v1 list operation
Since the move to using the requests library, v1 list operations keep
the connection open to the glance server. This is normally closed by the
garbage collector if it is not explicitly closed, however the paginate
function used by the list method had a circular reference preventing it
from ever being collected during the lifecycle of a service consuming
glanceclient.

This is problematic, since it causes long running nova processes to run
out of file descriptors for new connections.

This patch makes paginate() non-recursive, which allows the connection
to be freed.

Change-Id: I16a7b02f2b10e506e91719712cf34ef0aea1afc0
Closes-Bug: 1423939
2015-03-04 20:07:53 +00:00
Louis Taylor
d3814693a8 Add release notes for 0.16.1
Release notes for the following commits:

$ git log --oneline --no-merges 0.16.0..HEAD
96871b9 Fix tests failing if keystone is running locally
2d67dfa Unify using six.moves.range rename everywhere
af29e0a Show error on trying to upload to non-queued image
ef9fd9f https: Prevent leaking sockets for some operations
01caf4e Strip json and html from error messages
7ee96cb Register our own ConnectionPool without globals
1d82396 Remove graduated gettextutils from openstack/common
a755d1f Workflow documentation is now in infra-manual

Change-Id: Ieed106bff9aa95a7d40b0c39717aa16db4ddbf7e
2015-03-04 17:42:12 +00:00
Jenkins
e6d2f637ed Merge "Show error on trying to upload to non-queued image" 2015-03-04 17:05:02 +00:00
Jenkins
ab52bf3ce2 Merge "Unify using six.moves.range rename everywhere" 2015-03-04 16:29:50 +00:00
Jenkins
5ce1de9da4 Merge "https: Prevent leaking sockets for some operations" 2015-03-04 08:38:19 +00:00
Jenkins
d8d6cd5dda Merge "Workflow documentation is now in infra-manual" 2015-03-03 23:41:24 +00:00
Jenkins
74884fb3a1 Merge "Fix tests failing if keystone is running locally" 2015-03-03 23:39:02 +00:00
Jenkins
7f9b643371 Merge "Remove graduated gettextutils from openstack/common" 2015-03-03 23:38:17 +00:00
Kirill
6e0b1f4d2b removed excessive call to os.path.exists
os.path.isfile checks for existance anyway so
there is no point in checking both isfile and exists

Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3
2015-03-03 01:03:28 +03: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
Jenkins
99c46d64a0 Merge "Strip json and html from error messages" 2015-03-01 16:19:15 +00:00
Jenkins
db0179f5c4 Merge "Register our own ConnectionPool without globals" 2015-02-26 21:29:06 +00:00
Erno Kuvaja
2d67dfa97a Unify using six.moves.range rename everywhere
Mainly to improve consistency, use range() from six.moves
renames across glance.

Behaves consistently like py2 xrange() and py3 range().

Change-Id: I7c573a3a9775f454b98d25f2a14f8e9f5f4ac432
2015-02-25 12:17:24 +00:00
Louis Taylor
519672f5d5 Add release notes for 0.16.0
This adds release notes for the following commits:

$ git log --oneline --no-merges 0.15.0..HEAD
f7cdc3e Glance image delete output
a3eaafe Updated from global requirements
e99e0c8 Change oslo.utils to oslo_utils
96ff6e4 Return 130 for keyboard interrupt
db743e3 Ignore NoneType when encoding headers
869e6ac Use utils.exit rather than print+sys.exit
5ec4a24 Remove uuidutils from openstack-common
93c9bc1 Add a `--limit` parameter to list operations
9daada9 Fixed CLI help for bash-completion
878bdcb Remove openstack.common.importutils
b818826 Remove openstack.common.strutils
35c9b65 Adds basic examples of v2 API usage
363b170 Sync latest apiclient from oslo-inc
f210751 Close streamed requests explicitly
62df6c6 Handle HTTP byte returns in python 3
aebbcff Updated from global requirements
cb046bc Add validation to --property-filter in v1 shell
6eaaad5 Make non-boolean check strict
9054324 Disable progress bar if image is piped into client
df02ee8 Fix Requests breaking download progress bar
e3600ad Fix broken-pipe seen in glance-api
b96f613 Update HTTPS certificate handling for pep-0476
8e8dde2 Output clear error message on invalid api version
bd73a54 Add os_ prefix to project_domain_name/id
465c5ce Curl statements to include globoff for IPv6 URLs
9dcf3f1 Reduce the set of supported client SSL ciphers

Change-Id: Ib97fd745f1f6761b88246351ce2c63d11ad29b01
2015-02-23 23:08:33 +00:00
Jenkins
437c44f40b Merge "Fixed CLI help for bash-completion" 2015-02-23 19:02:44 +00:00
Jenkins
93ca39ba18 Merge "Reduce the set of supported client SSL ciphers" 2015-02-23 16:06:48 +00:00
Jenkins
654ba87a89 Merge "Glance image delete output" 2015-02-20 14:48:49 +00:00
Jenkins
72f0bc3579 Merge "Update HTTPS certificate handling for pep-0476" 2015-02-19 17:58:58 +00:00
Louis Taylor
af29e0a1b0 Show error on trying to upload to non-queued image
Previously, attempting to upload data to an image which has a status
which is not 'queued' would appear to succeed, when the data has
actually never been sent to the glance server. To the user, it appeared
that their request was successful. This patch adds a check for incoming
image data on the 'image-update' command, and exits with an error if the
specified image does not have the status 'queued'.

Examples:

    $ cat os.img | glance image-update d50b0236-b27c-412a-91b9-18ceafa9cc5a
    Unable to upload image data to an image which is active.

    $ glance image-update --file os.img d50b0236-b27c-412a-91b9-18ceafa9cc5a
    Unable to upload image data to an image which is killed.

Change-Id: I91bbd7f86d5851a5e35946c711dba1932283ed79
Closes-Bug: #1395084
2015-02-19 10:40:12 +00:00
Stuart McLaren
ef9fd9fca0 https: Prevent leaking sockets for some operations
Other OpenStack services which instantiate a 'https' glanceclient using
ssl_compression=False and insecure=False (eg Nova, Cinder) are leaking
sockets due to glanceclient not closing the connection to the Glance
server.

This could happen for a sub-set of calls, eg 'show', 'delete', 'update'.

netstat -nopd would show the sockets would hang around forever:

... 127.0.0.1:9292          ESTABLISHED 9552/python      off (0.00/0/0)

urllib's ConnectionPool relies on the garbage collector to tear down
sockets which are no longer in use. The 'verify_callback' function used to
validate SSL certs was holding a reference to the VerifiedHTTPSConnection
instance which prevented the sockets being torn down.

Change-Id: Idb3e68151c48ed623ab89d05d88ea48465429838
Closes-bug: 1423165
2015-02-18 12:31:24 +00:00
Abhishek Talwar
f7cdc3eefe Glance image delete output
Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."

Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.

Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
2015-02-17 11:27:24 +01:00
d34dh0r53
01caf4e734 Strip json and html from error messages
Error messages were being passed with either JSON or HTML formatting
leading to an unpleasant user experience. This strips the JSON or HTML
tags and presents the clean error message to the user.

Rewrote the lispy function to be more pythonic, added test cases
and cleaned up some pep8 violations.

Removed commented out cruft from a previous version of this
patch.

Changed the HTML details from a set to a list in order to ensure
the ordering of the exception details.

Added code to eliminate the duplicate detail messages from the list
and reordered the assertion string to match actual output.

Refactored duplicate elimination code to be more readable and
reliable.

Some reworking of the duplication elimination loop to make it
more readable.

Removed unneeded conditional to filter out empty elements.

Change-Id: I79985b3e305cb30328a3c16b025315a8e969243d
Closes-Bug: 1398838
2015-02-16 10:01:53 -06: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
Ian Cordasco
7ee96cbe39 Register our own ConnectionPool without globals
Currently, on systems like Fedora and Debian, it is possible to import
urllib3 as well as requests.packages.urllib3. They functionally point to
the same code but sys.modules considers them to be separate items. When
downstream packagers unvendor urllib3 from requests, they also change
all the imports inside of the package. So if the code imports urllib3
from requests.packages.urllib3 and modifies globals in a submodule, that
will not be visible to requests since it has been rewritten to use
urllib3 (not requests.packages.urllib3). By handling this logic
ourselves, we can issue a release until upstream packages and requests
can fix this and cut a new release.

Change-Id: Ic77ce8a06d9d148a899b4b8695990fca8fdaefc5
Closes-bug: 1396550
2015-02-06 13:49:13 -06:00
OpenStack Proposal Bot
a3eaafefbd Updated from global requirements
Change-Id: I06268c3e638716366c38181cb6364a2fce7bafee
2015-02-06 19:06:17 +00:00
Jenkins
1c37721287 Merge "Return 130 for keyboard interrupt" 2015-02-06 16:23:21 +00:00
Jenkins
60e7beb28b Merge "Change oslo.utils to oslo_utils" 2015-02-06 12:44:17 +00:00
Jenkins
0272106717 Merge "Close streamed requests explicitly" 2015-02-06 12:16:46 +00:00
Jenkins
ffcb324efc Merge "Adds basic examples of v2 API usage" 2015-02-05 22:44:16 +00:00
Louis Taylor
e99e0c8690 Change oslo.utils to oslo_utils
The oslo.utils libraries are moving away from namespace packages.

This requires oslo.utils>=1.2.0

bp drop-namespace-packages

Change-Id: I803df61e91eabb96329d859aef6bea03530fb84f
2015-02-05 22:27:16 +00:00