django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
ungettext(), and ungettext_lazy() are deprecated in favor of the
functions that they’re aliases for: django.utils.translation.gettext(),
gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().
https://docs.djangoproject.com/en/4.0/releases/3.0/#id3
Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
This function is only used in the Container get
method which retrieves details about a container.
It's not used for listing data in the container
even though with_data was True doing a GET instead
of a HEAD on the container.
This indirectly also fixes the Ceph bug [1] in the
Swift API implementation that doesn't expose metadata
correctly for a GET but does for a HEAD.
[1] https://tracker.ceph.com/issues/47861
Change-Id: Iba4215b2e3a414d1794faa05be31bf69e0e48bec
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.
Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
+ Adds endpoint for listing available policies
+ Support to select a storage policy for new containers
+ Display container storage polcy on dashboard.
Change-Id: I588452fd5d6417859f5dd19ccedcb18f420ab646
We don't support Python 2 anymore so we don't need this
compatibility library.
six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.
This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.
Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
Keystone V2 API was deprecated in Stein release in Horizon and
removed from Keystone in Queens release.
Change-Id: I917e273d3174adf0874e516b3d635ccb8ba58a27
Currently horizon defines default values of settings in the logic
using getattr(settings, <setting name>, <default value>) and
it is not easy to handle the default values of available settings.
This commit starts the effort to define default settings explicitly.
This is a preparation for ini-based-configurations.
It covers settings in openstack_dashboard/api.
Part of blueprint ini-based-configuration
Change-Id: Id4c3287f0a572fd14ea93b54bcab8fabda39e583
In case of error Swift API return some details about unsuccessful
request, i.e. internal IP, full object pass, etc. This response is not
processed by Horizon and presented to user as-is, which is potentially
insecure. Proposed patch adds error processing striping network location
from error message
Change-Id: Ieef9669a1be3ed7bbc685a457eb1fe86b34c3c7e
Closes-bug: #1794767
Current Horizon does not have object copy page for swift.
This blueprint is for adding above one as Angular application.
- One row action is added as "Copy" menu
- User can copy which bytes > 0
Because bytes = 0 means, true 0 byte object or separated file.
Copying of separated object is not allowed in Swift API.
Change-Id: I60d731f79e5c9ab55fd2a73b7687b47723fe901f
Implements: blueprint swift-object-copy-function
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.
Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.
Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
Added server-side filtering for containers in swift UI using the
magic search directive.
Change-Id: Id0eaa818fab8b2c7d7a0ab40c1a943c2e7342f10
Partial-Implements: blueprint server-side-filtering
Since Horizon is going to be the first (or, one of the first)
OpenStack component using the new MongoDB driver, it won't be able to
retrieve traces made by other components using MongoDB driver (which
it should use because Ceilometer driver was too slow) for a
while. This means that Horizon itself is responsible for tracing the
rendering of its pages down to the layer where the flow of control
leaves Horizon domain. So, a lot of api wrappers in
openstack_dashboard.api are augmented with tracing decorator to
achieve this goal.
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Implements-blueprint: openstack-profiler-at-developer-dashboard
Change-Id: Ib36692f0e9e68ed7fa0cd47919ba6581c9c8ab57
The containers module was using an incorrect ID in the "Size" column,
preventing the user from sorting by "Size". This change updates the
ID s/size/bytes/ which is the resource property holding the actual object size
in Bytes.
This change also updates the default "subdir" size to 0, that is the
default value returned in the "Content-Length" header for "subdirectories"
Change-Id: I98d164ec1a08d15f25fcdbc92f45e46c9fa6e5c4
Closes-bug: 1643710
The ability to update (edit contents of) an object was
never present in the previous Swift UI. It was
explicitly blocked due to code in the swift_upload_object()
function, which has been removed in this patch. To
replace that "upload would replace existing contents"
check, this patch implements a client-side check to warn
the user if the upload would do so.
Partially-Implements: blueprint swift-ui-functionality
Change-Id: I9fb57dda59322907f0661372f9ee223551ff8a6e
This memoize usage holds on to connection objects for a very long
time, resulting in exhaustion of file descriptors.
Change-Id: If7367819b050a65562b3e05175ab15bd93d0d398
Fixes-Bug: 1584109
Swift doesn't really have folders, it just has object listings
matching string prefixes. This will get confused if two objects
have the same string prefix name, so just don't do it.
Change-Id: Iab818cc965aab1470aa41ebebd5db7c50ed3836d
Fixes-Bug: 1583391
First, tolerate missing '/info' API endpoint, which Ceph doesn't
support yet. Second, `content_type` attribute on objects may be not
set, don't rely heavily on it.
Change-Id: I101338aa9c96a6551bfbf2dd9c460a4801b4e7b6
Closes-Bug: #1564834
Adding the REST API needed to support the new angular Swift UI.
Co-Author: Neill Cox <neill@ingenious.com.au>
Change-Id: Ife1073cf6aa481bdbd89f09805ac76fe7106d5df
Partially-Implements: blueprint angularize-swift
Show error message instead of success message when attempting to
create a duplicate object or pseudo-folder. Added tests for
creating and creating duplicate pseudo-folders.
Change-Id: I875d471921d9a37bb6706a17d4fbca5e9428ae93
Closes-Bug: #1478126
This patch adds missing content-length header
param into swift_upload_object() method.
Without it object upload handling could be failed
with "411 Length Required" error if Ceph is used
as an object storage.
Change-Id: Id0813806abb36a6f015efd13ec987492a3701476
Closes-Bug: #1352256
The variable _safe_message is linked to logic that is either no
longer used or not implemented. Removing the variable is a part
of improving the exception message by using 1 source to generate
the exception message
Partially Implements: blueprint improve-error-message-details-for-usability
Change-Id: Ied1acf22790cdedad685990fc628462d51b1477e
To prevent memory overrun when downloading large objects from Swift
* `resp_chunk_size` keyword should be passed to swiftclient
* `obj.data` iterator returned from swiftclient is passed to HttpResponse
(or StreamingHttpResponse for Django>=1.5) as usual since both response
classes work with iterators/files/byte strings (yet StreamingHttpResponse
does it better).
The commit introduces new setting SWIFT_FILE_TRANSFER_CHUNK_SIZE that
defines the size of chunk in bytes for Swift objects downloading.
DocImpact
Change-Id: I18e5809b86bfa24948dc642da2a55dffaa1a4ce1
Closes-Bug: #1427819
oslo_utils moved out of the oslo namespace.
Partially Implements: blueprint drop-namespace-packages
Change-Id: I3c38426142de535b5474676b1214ea72b231ce76
while try to delete a pseudo folder which contains some objects is
showing the success message but the folder is not actually deleted
added a check similar to delete container, the new check will
verify the pseudo folder is empty before call the swift client
call. if the folder is not empty it will throw a exception
with a appropriate error message and the message will be shown to
the user in the pop up message box.
Change-Id: I0bbea6ef6ac26ef357240610535b9d84053a89c2
Closes-Bug: #1347598
Previously token values are logged as DEBUG level when a new client
object is instantiated. In other project and clients, token values
are now not logged and is output as *REDACTED* instead.
In Horizon these log lines do not have much meaning and
we can simply remove them.
Change-Id: I67617ac6424907574d79ec2a57b513a548e220d2
Closes-Bug: #1380642
E127 continuation line over-indented for visual indent
Also fixes E127 introduces by other reviews
after other E127 fixes were merged.
Closes-Bug: #1375931
Change-Id: I0a09f1c2f74c707fc8a347f0ea5975bf2679976e
Rather than sync'ing with oslo-incubator, let's use the library
oslo.utils instead. Removing the local copy of timeutils.
Change-Id: I4fbc7e7637577fcad8281897f4286690b1bbd14d
Partially-Implements: blueprint improve-oslo-usage
When using urlparse.quote, the string needs to be utf8 encoded,
or an exception is thrown.
Change-Id: I1e3d4abc136fbbbd03a54789f3df0855ceea98e1
Closes-Bug: 1346386
Co-Authored-By: Cédric Soulas <cedric.soulas@cloudwatt.com>
Previously API client object like novaclient are created
every time methods in openstack_dashboard/api.
It leads to regeneration of API HTTP connections.
This commit caches API client object for a WSGI request
to reduce the number of HTTP connection to backends.
As WSGI request object is recreated, a cached API client
object will live in a single request to Horizon.
Change-Id: I66620b3b0a2737c7232d91006e65d0fabbd3090b
Closes-Bug: #1352144
The swift API client connection does not respect the
OPENSTACK_SSL_NO_VERIFY setting in the local_settings.py.
As a result a SSL verfication error happens with a
self-signed certificate.
Closes-Bug: #1311357.
Change-Id: I907a8f7c5c631adfaf2ca66385749bb8e86734f2
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4
at the top of source code files, except for files in
openstack/common.
Change-Id: I9a5c6b17c6ef7ecec601f4503dfc7b31fc72e90a
Close-bug: #1229324
Now the user can create an Object without providing an actual file
in the containers view. This will submit an object with 0 bytes size.
Additionally, the 'Download' button will not be available for objects
with 0 bytes size.
Implements: blueprint metadata-only-object
Change-Id: Ib2ff2462b73d16c971ad0dfc60aaae1b0bbf0924
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.
I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.
I also removed a few unused imports that were revealed in the process.
Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
Allow the user to set the container access to private or public.
For public containers, the public URL for accessing it is also provided
to the user.
List containers does not include the metadata of the container. Used ajax
to load the container metadata in the Container table to be able to render
the Container table immediately.
Change-Id: If1e848ad49f522eab8f1b264d54611615481848c
Implements: blueprint swift-container-public-access
When user tries to delete non-empty container, the success messsage
should not be displayed.
Change-Id: I02ba1e4bad8dbe2b52f06f2a8e079b5812cd5544
Closes-bug: 1214842
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.
Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
GET operation downloads the whole object, replaced the call
with HEAD which already contains the object metadata.
Change-Id: I87e1145d9571013db3dd87c3386d0dd66da3f012
Closes-bug: 1236681
The various OpenStack client libaries support specifying a SSL
certificate that should be used to verify the SSL-connection, but
this option was not exposed in the horizon options. This patch
implements that. Note that although some clients do implement a
cacert-parameter, they do not necessarily actually verify the
certificate (Swift).
Change-Id: I9dfbd48a0d96103421da7d884e839d591a90cab1
Implements: blueprint ssl-cacert