The schema_args decorator generates command line options based on the
properties defined in a schema. This commit makes sure read-only
properties are skipped during this process, since trying to modify their
value would result in a Glance error.
Closes-Bug: #1561828
Change-Id: I7ccc628a23c9ebdaeedcb9e6d43559f497ce9555
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I446ee142c7a17446372c910f7f2a36d55df18e04
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Currently, when the virtual size of an image is not known, "None" is displayed.
To a regular user, it feels like a programming error. We try and make things
clearer by using a "human readable" string instead.
Change-Id: Id7b8799356857d9bc58cc8a3677024fe1a7f4f56
Partial-Bug: #1665037
"glance image-tag-update" command returns unicoded response
for lists. Therefore it requires print_list method from util
class to handle such case. Added unicode_key_value_to_string()
method to remove extra 'u' from lists and dictionaries. This
fix is inspired from cinderclient's implementation.
Change-Id: I16a04e8d34f7629f72fe389456001ca1db9335ea
Closes-bug: #1534046
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
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
If it has a value of boolean true,
this keyword indicates that the instance property SHOULD NOT be changed,
and attempts by a user agent to modify the value of this property are expected to be rejected by a server.
The value of this keyword MUST be a boolean.
The default value is false.
Further link for reference: http://json-schema.org/latest/json-schema-hypermedia.html#anchor15
Closes-Bug: #1521581
Depends-On: I279fba4099667d193609a31259057b897380d6f0
Change-Id: I96717506259c0d28500b8747369c47029b1dd9b6
We need all the headers to be safe strings so they can be joined
together and not become an unicode string in doing so.
This fixes a bug when creating an image with non-ascii characters in the
name.
This is required for python 2.6 compatibility.
Change-Id: I66ebc27edf4ccd8f903399da58705711c372536d
Closes-Bug: 1448080
The oslo.utils function has exception_to_unicode that can
replace glance util function exception_to_str.
So we don't to have this exception_to_str function in glance
anymore.
Change-Id: I332bc55558087920fdd6ae2d822bece5166f5ba6
In case that a sensetive header (that should be obscured by its SHA1
hash) is None, the safe_header throws an exception which fails the
calling process and by that may harm the functionality.
Change-Id: I56944a382fd546eba0a6dd6d6b1cecf83b1dc106
Closes-Bug: #1491311
This commit enables new flake8 checks:
* E265 block comment should start with '# '
* H405 multi line docstring summary not separated with an empty line
* E123 closing bracket does not match indentation of opening bracket's line
* H238 old style class declaration, use new style (inherit from `object`)
* E128 continuation line under-indented for visual indent
and makes related changes in the code.
Change-Id: Ie993afc930f6b74d7a990bcaa9fc0e9f5ba1585c
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
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