summaryrefslogtreecommitdiff
path: root/glanceclient
Commit message (Collapse)AuthorAgeFilesLines
* Migrate dsvm functional test jobs to project repoBrian Rosmaita2018-02-051-46/+0
| | | | | | | | | | | | | | | | | | | | Zuul3-related changes in master have moved functional test gate configuration out of infra/project-config and into the glanceclient repository. This patch backports these changes so that the stable branch has functional test gates. Not a pure cherry-pick, also includes setting SWIFT_HASH, which did not have to be done in master. Co-authored-by: Monty Taylor <mordred@inaugust.com> Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> (cherry picked from commit c0e63d977fc077be55a02106403840165b89a349) (cherry picked from commit a5985508817e5de73092a339f15ce7f9f701a20f) Depends-On: I84de60181cb88574e341ff83cd4857cce241f2dd Depends-On: I0fecb027e5be6f4d7bb0bf34e59a43543a421f38 Change-Id: Idaa2f4b920e131320499c9e460ade74df1d5a264
* image-create-via-import fails with ValueErrorAbhishek Kekane2017-08-241-1/+4
| | | | | | | | | | | | | | | CLI image-create-via-import fails with ValueError. The reason is create command returns RequestIdWrapper object and not image and response. Further it fails with AttributeError: 'Namespace' object has no attribute 'import_method'. The reason is do_import_image() call requires 'import_method' as input which is not provided at the moment. Change-Id: Ic4c4d1f3c5d290b584840e8f9047fb53611a5748 Closes-bug: #1711511 (cherry picked from commit 335f1e944719023a887730a223353a4bdb209815)
* Fix image-import callBrian Rosmaita2017-08-241-1/+1
| | | | | | | | | | Change the request body sent from the client to be the format that the API expects for the image-import call. Depends-On: I08783e28719e63b5a4b2115b8fce135e55be460a Change-Id: I5e34d772d561306c6f103c859740658a825dd189 Closes-bug: #1711259 (cherry picked from commit e5b69eff693e7e012f867d83a54d737fedf74cb0)
* stage call fails with TypeErrorAbhishek Kekane2017-08-211-4/+6
| | | | | | | | | | | | | | | | | image-stage call fails with TypeError saying 'stage() takes exactly 3 arguments (4 given). The reason is stage() also accepts image_size as a argument which is not provided. Further it raises 'NoneType' object has no attribute 'headers'. The reason is stage() internally calls upload method which returns a object of RequestIdWrapper on body (which is None) and response. In stage call it again tries to add request id which requires response object but instead it has a RequestIdWrapper which fails to retrieve headers. Change-Id: I4de4be7a55f35c3533b53acd48042c7c95b4bdc0 Closes-bug: #1711090 (cherry picked from commit 0e50837a374958d2863deef890879c960a05d8aa)
* Add missing docstring2.8.0Erno Kuvaja2017-07-271-0/+1
| | | | | | Adding missing docstring for image-import command. Change-Id: Ide95056797230963e9ef63c1cb72d42e697023e7
* Merge "Add image import features to client"Jenkins2017-07-272-2/+133
|\
| * Add image import features to clientErno Kuvaja2017-07-272-2/+133
| | | | | | | | | | | | | | | | | | | | | | This change adds availability of the features introduced on Image Import Refactoring work. Including: Discovery call to discover what Import modes are available Staging call to stage the image for import in 'glance-direct' Import call to trigger the actual Image Import task EXPERIMENTAL: Image creation with the new workflow Change-Id: I2d10ac0cc951c933c3594837b490638e38ff0b12
* | Merge "Validate input args before trying image download"Jenkins2017-07-262-7/+22
|\ \
| * | Validate input args before trying image downloadRavi Shekhar Jethani2017-07-242-7/+22
| |/ | | | | | | | | | | | | | | | | | | | | | | Currently client is contacting glance service even if the caller has niether specified any redirection nor '--file' option. This unnecessary request although isn't causing any critical issues but can be avoided by simply doing input validation first. TrivialFix Change-Id: I841bebeda38814235079429eca0b1e5fd2f04dae
* | Merge "Make --profile load from environment variables"Jenkins2017-07-261-5/+7
|\ \
| * | Make --profile load from environment variablesTovin Seven2017-07-241-5/+7
| |/ | | | | | | | | | | | | | | | | | | --profile argument can be loaded from OS_PROFILE environment variables to avoid repeating --profile in client commands. Correct/update help text. Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com> Change-Id: I67c1e4b859b972e380eb658c98ceae4fbef5c254
* | Merge "help text for container_format, disk_format"Jenkins2017-07-251-2/+3
|\ \
| * | help text for container_format, disk_formatM V P Nitesh2017-07-061-2/+3
| |/ | | | | | | | | | | | | Updated the container_format and disk_format in v1 help text. Change-Id: I4ebe4982c179450defe8ad5703999f4074ae32f8 Closes-Bug: #1659010
* | Removed the --no-ssl-compression parameter which is deprecatedPranaliD2017-07-254-112/+0
| | | | | | | | | | | | | | | | --no-ssl-compression is deprecated and no longer used. So, it is removed from the help message. Change-Id: I2b886671a568ed191ee380cf16335ccd9ae85062 Closes-Bug: #1583919
* | Merge "Fix 'UnicodeEncodeError' for unicode values in url"Jenkins2017-07-241-38/+57
|\ \ | |/ |/|
| * Fix 'UnicodeEncodeError' for unicode values in urlbhagyashris2017-01-241-38/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used '%' instead of format() because format() function doesn't support the parsing of unicode codec like u'\U0001f693' in Python 2. Python3 parse unicode codec with .format() correctly. For example: openstack@openstack-VirtualBox:~$ python2 Python 2.7.6 (default, Oct 26 2016, 20:30:19) >>> '{0}'.format(u'\U0001f693') Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001f693' in position 0: ordinal not in range(128) >>> '%s' % (u'\U0001f693') u'\U0001f693' NOTE: format() fuction will parse unicode codec in Python 2 after prefixing 'u' like u'{0}.format(u'\U0001f693') but prfixing 'u' at every place is not good, so it's better to use the '%' module. Change-Id: I2fcca96a1356df08453e08487afb62dfec91ba9d Closes-Bug: #1570766
* | Merge "Replace assertTrue(isinstance()) with assertIsInstance()"Jenkins2017-06-301-1/+1
|\ \
| * | Replace assertTrue(isinstance()) with assertIsInstance()Van Hung Pham2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Some of tests use different method of assertTrue(isinstance(A, B)) or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B) provided by test tools. Change-Id: Ibb5e5f848c5632f7c1895c47b8c1a938f2c746c3
* | | turn on warning-is-error in sphinx buildDoug Hellmann2017-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix a formatting error in one docstring and turn on the flag to ensure that future warnings in the doc build trigger a build failure. Change-Id: I7159b985d1690a8ae61ff885408da4623c105952 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* | | add explicit dependency on pyopensslDoug Hellmann2017-06-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The library is used in glanceclient/common/https.py and the documentation build for the API fails without the dependency. Update the error handling so that when OpenSSL reports an error it is converted to a client communication error. Change-Id: I0c0fb3139bb848d0cbaf88ae6a767a730bea74eb Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* | | Merge "Replace six.iteritems() with .items()"Jenkins2017-06-2811-25/+22
|\ \ \
| * | | Replace six.iteritems() with .items()ji-xuepeng2017-02-0811-25/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.As mentioned in [1], we should avoid usingg six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I71c13040318eca6e5ed993e8aa03f8003986a71c
* | | | allow unhandled exceptions to cause test errorsDoug Hellmann2017-06-261-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hiding the unhandled exception in the test with a failure makes it harder to debug the problem. Let them pass unhandled so the test reports an ERROR instead of FAILURE. Change-Id: I4e435a6d276fdf161dac28f08c2c7efedd1d6385 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* | | | Merge "Remove log translations"Jenkins2017-06-191-10/+0
|\ \ \ \ | |_|/ / |/| | |
| * | | Remove log translationswangzhenyu2017-03-211-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Icf6423763f2d535b2c85c067d6e4a5676914e2c3
* | | | Merge "Allow global_request_id in Client constructor"2.7.0Jenkins2017-06-012-0/+22
|\ \ \ \
| * | | | Allow global_request_id in Client constructorSean Dague2017-06-012-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to pass in a global_request_id in the client constructor so that subsequent calls with this client pass that to the servers. This enables cross project request_id tracking. oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42 Change-Id: Iea1e754a263a01dae5ed598fdda134394aff54b0
* | | | | Downloading image with --progress failsAbhishek Kekane2017-05-292-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading image with --progress fails with "RequestIdProxy object is not an iterator". This is because to display download progress VerboseFileWrapper in progressbar requires object of IterableWithLength, but after support of returning request-id [1] to caller it returns RequestIdProxy object which is wrapped around IterableWithLength and response. To resolve this issue overridden next and __next__ methods in RequestIdProxy so that it can act as iterator for python 2.x and 3.x as well. [1] 610177a779b95f931356c1e90b05a5bffd2616b3 Closes-Bug: #1670464 Change-Id: I188e67c2487b7e4178ea246f02154bbcbc35a2b1
* | | | | Merge "Downloading image with --progress fails for python3"Jenkins2017-05-292-2/+7
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Downloading image with --progress fails for python3Abhishek Kekane2017-05-182-2/+7
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading image with --progress fails for python3 with, TypeError: 'IterableWithLength' object is not an iterator. This is because IterableWithLength class does not implemented python3 compatible __next__ method. Added __next__ method for python3 compatibility. Change-Id: Ic2114180fac26e9a60678f06612be733e8671bdb Closes-Bug: #1671365
* | | | v2: Content-Type: application/octet-stream header always addedckonstanski2017-05-194-8/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug: any existing Content-Type header cannot be found because the call to headers.get() fails. Therefore we end up with two Content-Type headers because a new one (applicaion/octet-stream) gets added unconditionally. The cause: the strings (keys and values) in the headers dict are converted from unicode sequences of type <str> to utf-8 sequences of type <bytes>. This happens in safe_encode() (oslo_utils/encodeutils.py:66). <str> != <bytes> even if they appear to have the same characters. Hence, for python 3.x, _set_common_request_kwargs() adds content-type to header even if custom content-type is set in the request. This results in unsupported media type exception when glance client is used with keystoneauth and python 3.x The fix: follow the directions in encode_headers(). It says to do this just before sending the request. Honor this principle; do not encode headers and then perform more business logic on them. Change-Id: Idf6079b32f70bc171f5016467048e917d42f296d Closes-bug: #1641239 Co-Authored-By: Pushkar Umaranikar <pushkar.umaranikar@intel.com>
* | | | Convert IOError from requestsEric Fried2017-05-192-11/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requests commit [1] changed the behavior when a nonexistent cacert file is passed in: now it raises IOError. This is getting through glanceclient.common.http.HTTPClient._request, which used to raise CommunicationError in this scenario. Even though there is arguably a better exception than CommunicationError to represent this condition (like maybe IOError), for backward compatibility this change set converts IOError to CommunicationError. We also improve the unit test to raise the original exception if the expected conditions aren't met; this improves debugability. [1] https://github.com/kennethreitz/requests/commit/7d8b87c37f3a5fb993fd83eda6888ac217cd108e Change-Id: I6a2cf4c6d041b67d3509153b4cef18b459263648 Closes-Bug: #1692085
* | | Merge "Replace functions 'dict.get' and 'del' with 'dict.pop'"Jenkins2017-03-061-3/+2
|\ \ \
| * | | Replace functions 'dict.get' and 'del' with 'dict.pop'bhagyashris2017-01-311-3/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring code: Making dict to use single instruction: pop() rather than two instructions: get() and del, giving the codes a format that carries through. TrivialRefactoring Change-Id: Idb21df37c287fdff24c29153676f82544f735297
* | | x-openstack-request-id logged twice in logsAbhishek Kekane2017-02-222-10/+28
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the recent release of keystoneauth1 2.18.0 provision is made to log x-openstack-request-id for session client. Once this new library is synced in openstack projects, the x-openstack-request-id will be logged twice on the console if session client is used. For example, $ glance --debug image-list DEBUG:keystoneauth.session:GET call to image for http://10.232.48.204:9292/v2/schemas/image used request id req-96a3f203-c605-4c96-a31d-f1199d41705c DEBUG:glanceclient.common.http:GET call to glance-api for http://10.232.48.204:9292/v2/schemas/image used request id req-96a3f203-c605-4c96-a31d-f1199d41705c Above log will be logged twice on the console. Removed logging of x-openstack-request-id in case of SessionClient as it is already logged in keystoneauth1. x-openstack-request-id will only be logged once on console if HTTPClient is used. Depends-On: I492b331ff3da8d0b91178bf0d5fe1d3702f15bd7 Closes-Bug: #1657351 Change-Id: I64258f997dc060113f53682aee74bdd40a346e54
* | Merge "Replace dict.iteritems() with dict.items()"Jenkins2017-01-241-2/+2
|\ \ | |/ |/|
| * Replace dict.iteritems() with dict.items()Luong Anh Tuan2016-12-201-2/+2
| | | | | | | | | | | | | | Following Python 3 guide https://wiki.openstack.org/wiki/Python3 Thus, we should replace task.iteritems() with task.items() Change-Id: If617c3a87836930dc78a4ce7dd45a9b7804e0d24
* | Merge "Add support for community images"Jenkins2017-01-233-3/+21
|\ \
| * | Add support for community imagesAlexander Bashmakov2016-11-103-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for community images retrieval and creation in the Glance client. Depends-On: I94bc7708b291ce37319539e27b3e88c9a17e1a9f Change-Id: I81e83eab5a9d30643c354f0cb6df425cf7a7bae3
* | | Merge "Add request id to returned objects"Jenkins2017-01-2318-211/+567
|\ \ \
| * | | Add request id to returned objectsRavi Jethani2017-01-2018-211/+567
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding two classes RequestIdProxy and GeneratorProxy derived from wrapt.ObjectProxy to wrap objects returned from the API. GeneratorProxy class is used to wrap generator objects returned by cases like images.list() etc. whereas RequestIdProxy class is used to wrap non-generator object cases like images.create() etc. In all cases the returned object will have the same behavior as the wrapped(original) object. However now the returned objects will have an extra property 'request_ids' which is a list of exactly one request id. For generator cases the request_ids property will be an empty list until the underlying generator is invoked at-least once. Co-Authored-By: Abhishek Kekane <abhishek.kekane@nttdata.com> Closes-Bug: #1525259 Blueprint: return-request-id-to-caller Change-Id: If8c0e0843270ff718a37ca2697afeb8da22aa3b1
* | | | Add ploop in disk_formatEvgeny Antyshev2017-01-194-4/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "ploop" image format is supported in upstream Glance https://review.openstack.org/341633 And similar patch has been added in python-openstackclient: https://review.openstack.org/411405 Co-Authored-By: yuyafei <yu.yafei@zte.com.cn> Change-Id: I1471224df97cf5fecfe7f02e549855af81c45848 Related-Bug: 1650342
* | | Merge "Handle formatting of subcommand name in error output"Jenkins2017-01-132-1/+64
|\ \ \
| * | | Handle formatting of subcommand name in error outputIan Cordasco2017-01-112-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Python 2, decoding all arguments leads to the possibility that users that use the wrong command or mistype the name will see error output with a unicode string's representation instead of one without it. To avoid this we try and find the first non-option string in the argument list and replace it with an string that is not text only on Python 2. If we encoded the string at all times, then users installing glanceclient on Python 3 would see b'invalid-subcommand' instead. That's as bad as seeing u'invalid-subcommand' on Python 2. Closes-bug: 1533090 Change-Id: I018769e159a607ebb233902cbeb13b95ca417190
* | | | Add vhdx in disk_formatLi Wei2017-01-104-3/+59
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | vhdx is also a format of the disk valid value in v2 version, so add it in disk_format. Related-Bug: 1635518 Co-Authored-By: Stuart McLaren <stuart.mclaren@hpe.com> Change-Id: I7d82d4a4bdb180a53e86552f6f6b3bed908e6dc0
* | | Merge "Use import_versioned_module from oslo.utils"Jenkins2016-12-163-10/+6
|\ \ \
| * | | Use import_versioned_module from oslo.utilsLi Wei2016-12-063-10/+6
| |/ / | | | | | | | | | | | | | | | | | | oslo.utils 3.17 provides this funtion, so just use it directly. Change-Id: I85cb78a6fd33a5b1f7e09648efed1b0737678eee Closes-Bug: #1627313
* | | Merge "Revert "Add last_request_id member to HTTPClient and SessionClient""Jenkins2016-12-142-12/+0
|\ \ \ | |/ / |/| |
| * | Revert "Add last_request_id member to HTTPClient and SessionClient"Abhishek Kekane2016-05-232-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9e532db8b0f0ba537edef143a6f5380a2aaa1e4b. If glanceclient is used in multi-threaded environment, then there is a possibility of getting invalid/wrong last request-id. To avoid this, need to use thread local storage to store last-request-id and add public method to return this request-id to caller. http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html#alternatives Change-Id: I08d8d87fc0cc291f1b930b2c0cfc110ec8394131
* | | Merge "Add Apache 2.0 license to source file"Jenkins2016-11-181-0/+12
|\ \ \