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
requests-mock is a tool specifically designed for mocking responses from
the requests library. Use that instead of handling mox and mock
ourselves.
Change-Id: Ifd855b8d6c1b401e29ac210593c48d2da87a571b
Currently, the FakeSchemaAPI in tests/utils has an overriden __init__
method which simply calls super of FakeAPI and doesn't perform any extra
operations. This is redundant, because same effect will be achieved when
__init__ definition is omitted in FakeSchemaAPI. Additionally it uses
'cls' as first param instead of 'self' which breaks naming convention.
Change-Id: I3e72adfbc7b67076748f640d74507ff28c6060d7
Closes-Bug: 1418508
$ git log 0.16.1..HEAD --no-merges --oneline
db5d729 Updated help for v2 member-update api
3f3066b Extend images CLI v2 with new sorting syntax
bbd27d5 Add the ability to specify the sort dir for each key
976fe17 Import sys module
fc79467 Adds the ability to sort images with multiple keys
f00f769 add examples for properties and doc build script
f6f5733 Apply expected patch format when updating tags in v2.images
a9a692b v2: read limit for list from --limit in shell
0ab5a78 Fix leaking sockets after v2 list operation
f98ab68 Fix leaking sockets after v1 list operation
6e0b1f4 removed excessive call to os.path.exists
b47925e Unit tests covering missing username or password
b64dba8 Remove duplicate 'a' in the help string of --os-image-url
6d21959 v2: Allow upload from stdin on image-create
4c7c7ad Fix v2 image create --file documentation
eeef763 Fix minor typo in version error message
Change-Id: I90d7e4a5109d82e25a63135e94193f4c4f7d4f34
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
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
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
Previously this was read from the --page-size argument, which lead to
incorrect behaviour.
Change-Id: I08ecda95eca0ff524e28a1d5371ce6c73dfc548e
Closes-Bug: #1429088
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
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
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
os.path.isfile checks for existance anyway so
there is no point in checking both isfile and exists
Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3
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
Mainly to improve consistency, use range() from six.moves
renames across glance.
Behaves consistently like py2 xrange() and py3 range().
Change-Id: I7c573a3a9775f454b98d25f2a14f8e9f5f4ac432
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
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
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