46 Commits

Author SHA1 Message Date
Akihiro Motoki
e6b78f92f2 Use flake8-import-order plugin
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
2017-07-03 08:02:23 +00:00
Luis Daniel Castellanos
277d15abff Added Server-side filtering for swift UI
Added server-side filtering for containers in swift UI using the
magic search directive.

Change-Id: Id0eaa818fab8b2c7d7a0ab40c1a943c2e7342f10
Partial-Implements: blueprint server-side-filtering
2017-02-06 15:28:58 -06:00
Paul Karikh
97945b5f6a Wrap api calls with tracing decorators
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
2016-12-01 19:31:10 +00:00
Eddie Ramirez
9963867cd9 Enable sorting by size in containers pane
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
2016-11-30 17:49:10 +00:00
Richard Jones
053d0a669e Implement file update (edit) in Swift UI
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
2016-08-22 14:47:23 +10:00
Richard Jones
2481d2b1ac Remove memoize that holds connections open
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
2016-05-27 05:55:34 +00:00
Richard Jones
75d30cba48 Don't attempt to list the "folder" contents of Swift objects
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
2016-05-19 11:29:20 +10:00
Timur Sufiev
80e52c1ae5 Fix new Swift UI to work with Ceph backend
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
2016-04-04 18:24:18 +03:00
Richard Jones
672b6ae003 Add Swift REST API
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
2016-02-25 12:12:14 -08:00
Javeme
de9449aab1 replace deprecated iso8601_from_timestamp
use datetime.utcfromtimestamp() and datetime.isoformat() instead of
the deprecated oslo.timeutils.iso8601_from_timestamp().

ref:
https://github.com/openstack/oslo.utils/blob/master/oslo_utils/timeutils.py#L192

Change-Id: Ife656079e332789235829ab138e8df057d91172f
2015-12-17 16:56:42 +08:00
zhu.rong
4636bf18d7 Delete the unused LOG configure code
Delete the unused LOG configure code and import code

Change-Id: I5e42a3b25aae89e62e20e8061b39c7be700aba33
2015-12-09 02:04:29 -05:00
Ryan Peters
5693109901 Fixed getting success msg on failing swift operation
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
2015-07-24 19:27:24 +00:00
Paul Karikh
8201d65cf9 Add missing content-length header
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
2015-06-18 09:41:22 +00:00
George Peristerakis
a545a4b63e Removed the '_safe_message' variable from the API exceptions
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
2015-05-06 15:33:10 +00:00
Timur Sufiev
46405d456d Fix web-server memory overrun when downloading objects from Swift
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
2015-03-31 14:30:23 -07:00
lin-hua-cheng
0e95eb0441 Switch from oslo.utils to oslo_utils
oslo_utils moved out of the oslo namespace.

Partially Implements: blueprint drop-namespace-packages

Change-Id: I3c38426142de535b5474676b1214ea72b231ce76
2015-01-18 14:23:32 -08:00
Jenkins
8f2903ed2c Merge "wrong message while deleting non empty pseudo folder" 2014-12-09 09:37:28 +00:00
Masco Kaliyamoorthy
1565819d59 wrong message while deleting non empty pseudo folder
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
2014-10-30 15:18:04 +05:30
Akihiro Motoki
47f1d49690 Do not log keystone token
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
2014-10-17 16:10:41 +09:00
Jenkins
79df5b42ed Merge "Fix an encoding exception when creating a public_url" 2014-10-16 07:22:14 +00:00
Akihiro Motoki
26da6ed48c Fix E127 errors in remaining openstack_dashboard/
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
2014-10-15 13:50:07 +09:00
lin-hua-cheng
258ea5a172 Use timeutils from oslo.utils
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
2014-10-13 12:08:00 -07:00
George Peristerakis
2e4ae8f05d Fix an encoding exception when creating a public_url
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>
2014-10-08 15:00:52 -04:00
Akihiro Motoki
69e0d812f2 Reuse API client object in a request
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
2014-09-17 14:19:10 +09:00
Chuck Short
456c69e0b3 swift: Respect the OPENSTACK_SSL_NO_VERIFY setting
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>
2014-09-16 10:38:21 +01:00
He Yongli
e790ac070e Remove extraneous vim configuration comments
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
2014-05-06 15:30:10 +08:00
Fengqian Gao
b7d5a6e749 Keep py3.X compatibility for urllib
Use six.moves.urllib.parse instead of urllib

Partial-Bug: #1280105

Change-Id: Ie10e9fd8ff42b65b1610839eaeee09e3c56f2de7
2014-02-24 13:46:29 +08:00
Cristian A Sanchez
ccc0f7290f Allows the user to create an object without file
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
2013-12-14 11:05:18 -08:00
Radomir Dopieralski
028332da4a Remove #noqa from most common imports and add them to import_exceptions
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
2014-01-07 12:26:35 +01:00
Jenkins
cdb06a48de Merge "Show success msg when container deletion succeeds" 2013-12-03 03:51:45 +00:00
Lin Hua Cheng
22ab3e0f87 Add ability to configure read access of container
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
2013-12-02 02:00:07 -08:00
Lin Hua Cheng
52957cc7d9 Show success msg when container deletion succeeds
When user tries to delete non-empty container, the success messsage
should not be displayed.

Change-Id: I02ba1e4bad8dbe2b52f06f2a8e079b5812cd5544
Closes-bug: 1214842
2013-11-27 20:32:59 -08:00
Jenkins
2d06e1b23f Merge "Adds pseudo-folder creation" 2013-11-26 20:30:04 +00:00
Paul Belanger
da8c69afa6 Gate on H4xx docstrings for pep8
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>
2013-11-23 12:51:07 -05:00
Laura Athanasiou
56ae1e84e4 Adds pseudo-folder creation
Users can create pseudo-folders independent of object upload

Implements: blueprint swift-pseudo-directory
Change-Id: I5797ae9aab83135643680a410b2394165dc55271
2013-10-16 13:15:16 -06:00
Jenkins
510eb5a5fc Merge "Use HEAD when retrieving Container details" 2013-10-14 19:09:28 +00:00
Lin Hua Cheng
22e8f839d1 Use HEAD when retrieving Container details
Change-Id: I0bb41bbf2ec8b0a515aa8a9ee9eba63761a60122
Closes-bug: 1236677
2013-10-08 14:08:38 -07:00
Lin Hua Cheng
2b36515e14 Use HEAD when viewing Object details
GET operation downloads the whole object, replaced the call
with HEAD which already contains the object metadata.

Change-Id: I87e1145d9571013db3dd87c3386d0dd66da3f012
Closes-bug: 1236681
2013-10-08 12:05:14 -07:00
Jasper Capel
12ab09a994 Custom CA certificate for verifying SSL connections
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
2013-09-03 11:24:41 +02:00
Tatiana Mazur
953d1b9793 Enable H302 check
This patch replaces some method imports with module imports and
makes H302 test enabled.

Fixes bug 1188531

Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
2013-08-22 17:39:09 +04:00
Lin Hua Cheng
7f51d55401 Display the container and object metadata
Display some of the useful metadata information from swift:
Container Details - Container Name, Object Count, Size
Object Details - Name, Hash, Content Type, Last Modified, Size

Change-Id: I6611cab08946a81624176c1836ceadaf16a68e45
Implements: blueprint swift-display-metadata
2013-08-20 11:08:43 -07:00
Matthias Runge
cea720e793 Sort imports alphabetically
This patch also re-organizes imports to import one per line.

Change-Id: Ia958e3a30a48d4308d08d51df243c1272425c316
Fixes: bug 1188529
Fixes: bug 1188537
2013-06-14 12:05:55 +02:00
Brooklyn Chen
eae19c1a7c Shows a warning message when deleting a container that contains data.
We cannot delete objects in the container since there may be millions
of objects in that. The batch deletion should be done in swift instead
of Horizon. The batch remove of objects function is only in swift CLI
command now. This commit replace the unclear message with a warning
message that tells the user the container is not empy.

Related bug: https://bugs.launchpad.net/horizon/+bug/1034890

Fixes bug: #1096084

Change-Id: I59b46a3535b8654734c3dae4eec916ab1b53c716
2013-05-19 18:39:42 +08:00
Brian Waldon
b36a285938 Remove placeholder objects for subfolders
A subfolder in a container is now represented solely by the prefix of
an object name delimited by a forward-slash (/). If an object exists
in a container that matches the implied subfolder of another object,
each will be displayed in the objects table.

Implements bp swift-folder-prefix

Change-Id: I05252c1db34fdf6584a71e8827ff6f8363bf0488
2013-02-15 12:01:06 -08:00
Tihomir Trifonov
4b1fc16789 Fixed unicode for object copy
Removed deprecated check for unicode symbols
in object names, fixed the reverse() for success_url,
which expects "/" to be included in path arguments.

Fixes bug 1008940

Change-Id: I1122437c40f8e31b64a82b39cd326141842ca519
2012-12-29 17:51:20 +02:00
Gabriel Hurley
cb8e7c1f8f Splits OpenStack Dashboard bits from framework app code.
Moves everything OpenStack-specific (dashboards, apis, etc.)
into the openstack_dashboard project, achieving a much
cleaner separation between the project-specific code and
the generic Horizon framework code.

Change-Id: I7235b41d449b26c980668fc3eb4360b24508717b
2012-10-11 11:47:50 -07:00