We were capped at a very old version of hacking. Hacking itself caps the
various linters it uses to remain consistent, so our pep8 job was not
checking quite a bit that current versions have added.
This raises that limit to the latest to get up to the level of other
projects and addresses the errors the updated linters uncovered.
Change-Id: I89a9d73fbd59606a649e26077acebc5c42873d67
Co-authored-by: Sean McGinnis <sean.mcginnis@gmail.com>
In Rocky, the v1 dependent glance-cache-manage command was removed while
removing Images API v1 entry points.
As a part of edge-computing image caching will play a big role. To
provide support of image caching, added cache-manage utility using
V2 API. This utility will have the same interface as Queens
glance-cache-manage utility [0] as far as possible.
[0] https://docs.openstack.org/glance/queens/cli/glancecachemanage.html
In addition to above command line options added below new options for doamin
information to use in v3 authentication:
--os-domain-id
--os-user-domain-id
--os-project-domain-id
Implements: blueprint cache-manage
Change-Id: I127c84f8ea610cc20eb3ac2f4f6a9a47a7233f5f
This change removes option to configure Images API v1
This change removes Images API v1 endpoints from the router
This change removes all v1 tests
This change removes the v1 dependant glance-cache-manage command
This change does not remove all v1 codebase. Further cleanup and
decoupling will be needed.
Change-Id: Ia086230cc8c92f7b7dfd5b001923110d5bc55d4d
The optparse module has been deprecated for some time and all apps
should be updated to use argparse instead. This switches our one
remaining command that was using it to the newer argparse usage.
Change-Id: I8f801fb804515ecf2a8b402b2923135379730098
Closes-bug: #1553030
Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).
Change-Id: Ie8008e83f432263e7a97e482e83f240b1056feee
Now, 'glance-cache-manage help' and 'glance-replicator help' don't
work. They returned wrong result. It is not user friendly at all.
Closes-bug: #1533927
Change-Id: I9b5ff7eaff4b27a5e964231dd4dfbf02a3fac7db
This change introduces glance.common.timeutils that provides the
timeutils previously consumed from oslo_utils.
Oslo is deprecating some timeutils functionality which of Glance
depends on. Suggested replacement (isoformat) would break glance APIs
so it's cleaner to carry this functionality in Glance rather than
re-invent the wheel.
Co-Authored-By: Erno Kuvaja <jokke@usr.fi>
Co-Authored-By: Sabari Kumar Murugesan <smurugesan@vmware.com>
Change-Id: I91e1cc9a273249fd88749cecf21200f3f5e2bab1
* Replace glance.common.utils.exception_to_str() with
oslo_utils.encodeutils.exception_to_unicode().
* Remove exception_to_str() from glance.common.utils
* Add "from oslo_utils import encodeutils" and remove "from
glance.common import utils" (when utils is no more used)
* glance/api/v2/images.py: replace utils.exception_to_str() with
six.text_type() to cast the oslo_i18n message to Unicode
Glance exception_to_str() function was not compatible with Python 3,
whereas exception_to_unicode() is compatible with Python 3, it's in Oslo
common libraries and it's well tested.
This patch was first generated by a tool (modified version of sixer),
and then fixed to respect the PEP8 (especially the constraint of 80
columns).
Change-Id: I86008c8adc0c5664f96573c1015cc15e2d06e3e2
* Replace unicode with six.text_type
* Replace "raise a, b, c" with six.reraise(a, b, c)
* Replace dict.iteritems() with six.iteritems(dict)
* Replace StringIO.StringIO with six.BytesIO for image content
* Get AssertionError from builtins, don't use the exceptions module
which was removed in Python 3
* Open configuration file in text mode (not in binary mode) in
functional tests
* Use absolute imports in artifacts_sample and image_artifact plugins
instead of relative imports.
* Fix usage of __import__() function: the level parameter expects a
positive integer, use level=0, not level=-1
* Get the input function from six.moves: use raw_input() on Python 2 and
input() on Python 3. raw_input() was renamed to input() in Python 3.
* Unpacking parameters in function definition is no more possible:
unpack the tuple manually in test_glance_replicator.py
* On Python 3, socket.fromfd() now returns directly the right socket
type. It's not more needed to cast manually the result of
socket.fromfd().
For more information on Python 3, see:
https://wiki.openstack.org/wiki/Python3
Change-Id: Iaa1a392590154058eab4645fb288d1534f66e528
To support Python3, unicode() calls has been replaced by
six.text_type.
Added utils.exception_to_str(): is the proper way to convert
an exception to string, since it manages logic related to
encoding.
Change-Id: I27101390e4f95e5c7690b1b445b7e75b8bcb9a08
Closes-Bug: #1284677
Follow oslo.config style guide for help strings better to create
consistent help strings:
* Capitalize first word of each help string
* Finish help strings with "."
Change-Id: Iac0a0fc0ea6c0cf23f2523fe6030a842810b6909
Bump hacking dependency to 0.8 to get python 3.x compatibility
Fixes done in order to avoid errors after enabling hacking 0.8
Change-Id: Ic878fe2e1bd3f65f7f95a9b5c7a192dac81b749d
Closes-Bug: #1257282
This commit makes the glance code base E125 and E126 compliant :
* E125 continuation line does not distinguish itself from next logical line
* E126 continuation line over-indented for hanging indent
Change-Id: I7120149bedb665fb66320498fe98948602a6cd52
Closes-bug: #1263437
Instead of globally ignoring Pyflakes and Hacking
warnings, blacklist explitly only those that trigger
numerously. Fix the rest alongway and start to gate
on those that are now passing.
Change-Id: Ia19dc708cf0ccab2da5b46d1652f16e901499c24
Currently, "image id" is got by "pop" method without checking length
of argument list in "queue_image" method(glance/cmd/cache_manage.py)
Consequently, only last element of argument list is used,
other elements are ignored.
ex)
glance-cache-image queue-image <image-id1> <image-id2> <image-id3>
-> <image-id3> is selected and queued.
<image-id1>/<image-id2> is ignored.
Because "glance-cache-image" command is user command(*),
I think that elements which are ignored should not be existed
and checking of length is essential.
In order to check length, I replaced "try/except" statement with
"if/else" statement.
Also, I modified 2 methods at the same point.
-delete_queued_image
-delete_cached_image
* http://docs.openstack.org/developer/glance/cache.html
Change-Id: I5cff1f9b5fe8f718ca74f1c9f58dba469396dc8f
Closes-Bug: #1236709
In python 3 print statement is not supported, so we should use
only print() functions.
Fixes bug 1226943
Change-Id: I0ae4cc7e5996ed30c69e153ba51438c56e56c09a
This patch makes modifications to the way that programs which the various
tests depend on are forked and executed. This will allow the tests to be
run without installing glance to a python installation (ie: python setup.py
{develop/install} will not be needed).
fixes bug: 1197800
Change-Id: I9687cb7a5b22747d9cea0a1c24057383a8901476
The usage message for glance-cache-manage lists "clean" as an available
command, but this functionality is part of a separate tool,
glance-cache-cleaner.
Remove any references to this to avoid confusion.
DocImpact
Fixes bug 1189451
Change-Id: I2aba8164ab9ef0c3bef31870cb3771233a722d27
Some options were showing up as %(default)s when running
"glance-cache-manage -h".
Fixes bug 1197472
Change-Id: I1c7586cbc52445e3bdca28a71378f40ecb5b07a9
Part of fixing bug #995287
Syncs these two commits from oslo-incubator:
Support overriding oslo localedir too
Add a gettextutils.install() helper function
to get a new gettextutils.install() function which allows the default
localedir to be overwritten via an environment variable.
Note that gettextutils.install() must be called before any other glance
modules are imported since some modules attempt to translate strings
at import time (e.g. the help strings for config options in config.py).
This is broken and inefficient, but fixing it involves adding something
like spinx's l_() function and would be very invaisve.
Also, note that calling gettextutils.install() in glance.cmd.__init__
means that no program which uses a different translation domain should
ever import any of the modules under glance.cmd.
Change-Id: I86562b3a65d371673bb21f7179eecc7602bc0775
The executable programs used by Glance have historically been scripts
in the ./bin directory. This patch converts all of the scripts to
entry_points. This change makes these programs python modules. Thus
they can be imported and methods in them can be called just like any
other module. This will allow the tests to call into these programs
directly instead of having to fork out a process.
The conf.py file in the doc tree was causing a name collision with
the python module cmd. The glance/glance directory was being added
to sys.path which made glance.cmd import with the name cmd. This
patch also fixes that problem.
blueprint: refactoring-better-faster-stronger-functional-tests
Change-Id: I67ae14b7403af31a5944befcd2ec27a690e81f15