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
Admin-Compute-Instances dashboard shows "-" as image name for every
instance. Despite, Project-Compute-Instances dashboard displays image
name correctly. Admin dashboard just lacks code to resolve image name
Also, reverted commit deb55b8 which functionality is not needed anymore
Closes-Bug: #1932341
Change-Id: Ieb19e66dc51165d9935424b2e9ab5cdae757b07f
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
When the image upload finishes, we try to delete the temporary
file that was used for the upload. However, depending on how
Horizon is deployed, instead of a file it can be a BytesIO
instance, which leads to an AttributeError. This happens in
a separate thread, so Horizon itself doesn't crash, but it's
better to catch that exception.
Change-Id: Iaa66d9c87060c1e001f3f6e31f630d6092df55d3
Closes-Bug: #1866632
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
This patch allows administrators to set disk_formats only for glance,
while horizon will retrieve list of supported formats from glance API.
IMAGE_BACKEND_SETTINGS still may be used to redefine display name
of the format or additionally limit list of availble ones.
Change-Id: Ia4ea513023895f4ad2a87f91e3d2837c7668d9ae
Closes-Bug: 1853822
Glance V1 API was deprecated in Stein release in Horizon and
deprecated in Glance since Newton release.
Change-Id: I18f6fd03dd3e07fa4f2ccfdccfdc3ca766c91c16
When editing an image, if the disk_fomrat is 'vhd',
the container_format was wrongly set to 'bare' before.
'ovf' is the correct container_format for 'vhd' disk images.
Closes-Bug: #1539722
Change-Id: Ic6b0c66af0d5c8db2d802d6eea2b97721d92b7eb
Cookie-based settings related to openstack_dashboard are located
under horizon directory,, but they are not related to "horizon".
This commit moves them to "openstack_dashboard" directory.
Part of blueprint ini-based-configuration
Change-Id: Id48ececdbe819a95485e9a91dc5a1a163a5568c3
Resolves the following warning:
DeprecationWarning: Using or importing the ABCs from 'collections'
instead of from 'collections.abc' is deprecated, and in 3.8 it will
stop working
Change-Id: Ib2214e7560cda1ef510c08859d5ee0726eb66b7b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
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
openstack_dashboard/context_processors.py:94:15: C0122: Comparison should be link['url'] != 'horizon:project:api_access:openrcv2' (misplaced-comparison-constant)
openstack_dashboard/settings.py:467:4: C0412: Imports from package horizon are not grouped (ungrouped-imports)
openstack_dashboard/enabled/_1370_project_vg_snapshots.py:9:0: C0301: Line too long (86/80) (line-too-long)
openstack_dashboard/enabled/_1360_project_volume_groups.py:9:0: C0301: Line too long (85/80) (line-too-long)
openstack_dashboard/usage/base.py:62:8: W0106: Expression "[instance_list.extend(u.server_usages) for u in self.usage_list]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:43:12: W0106: Expression "[public_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:75:12: W0106: Expression "[community_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/api/glance.py:47:4: C0412: Imports from package glanceclient are not grouped (ungrouped-imports)
openstack_dashboard/api/cinder.py:60:4: C0412: Imports from package cinderclient are not grouped (ungrouped-imports)
openstack_auth/user.py:358:4: E0211: Method has no argument (no-method-argument)
openstack_auth/user.py:362:4: E0211: Method has no argument (no-method-argument)
openstack_dashboard/api/keystone.py:75:4: C0412: Imports from package keystoneclient are not grouped (ungrouped-imports)
horizon/loaders.py:43:16: W0706: The except handler raises immediately (try-except-raise)
horizon/themes.py:174:8: W0706: The except handler raises immediately (try-except-raise)
Change-Id: I40cf3ffbc4519657e11180d2e2fe7401387c5556
This commit updates several places where image information is processed
and extends support for the 'community' image visibility value.
Some support did exist already, which was mostly just the main Images
tab of the dashboard, but this commit also includes support for:
- image name in the instances list/details
- 'Community' visibility label in the Images tab
- Listing of community images in launch instance wizard
Closes-Bug: #1779250
Change-Id: Iedea0b7d20313837a72a2759511251a7bb324869
When uploading an image, if we do not set a minimum ram and disk size we
try to send "None" to glance.
We should instead send "0" and glance will calculate the size from the
provided image.
Change-Id: Ia1aeabcdcf021943ebb7a4e35939c383ac820b19
Closes-Bug: #1809121
This patch uses glance list filtering, which allow to query images
for the list of required ids. See [1] for details.
Patch rebased to master. Added test for proposed Glance API request
[1] https://developer.openstack.org/api-ref/image/v2/#show-images
Related-Bug: #1508554
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Co-Authored-By: Vadym Markov <markov.vadim@gmail.com>
Change-Id: Iac485c1b448011fec97ba5bfaa83851914b294d9
It was unable to upload image when horizon was running on python3,
there was a problem with closed file in new thread. This commit is
fixing this issue with added if clause whether horizon running on
python2 or python3 and correctly call close_called on file when
running on python3.
Change-Id: Ice178f6269ac527ba62b26d86976b5336987c922
Closes-Bug: #1773935
Bug #1641383 was not fixed for REST API call.
The two implementation of create_image_metadata are merged
into api/glance.py.
There were minor differences in field naming and handling
(min_ vs minimum_, is_public vs public vs visibility).
This commit normalizes them to simplify the logic.
Closes-Bug: #1757136
Change-Id: I41e9d94345151bc4473d704cdc040ed77870ce45
- HORIZON_IMAGES_ALLOW_UPLOAD (deprecated in Newton)
- CUSTOM_THEME_PATH (deprecated in Mitaka)
- DEFAULT_THEME_PATH (deprecated in Mitaka)
- OPENSTACK_TOKEN_HASH_ENABLED (deprecated in Mitaka)
- TOKEN_DELETION_DISABLED
(not documented but it was marked as deprecated in Ocata
in django-openstack-auth commit 5810f9c6)
The related logics related to dropped deprecated settings
have been dropped too.
- custom_path and default_path of get_available_themes() were
dropped as they are no longer needed in favor of
the removal of CUSTOM_THEME_PATH and DEFAULT_THEME_PATH.
- Unused remove_project_cache(), is_token_deletion_disabled()
and delete_token() have been dropped.
Change-Id: Ic9406623cc092884c4136f78fb967b129bfda487
When using glance v2 client, it will leave an upload
tmp file in /tmp folder, which will cause upload error
if its filesystem (in memory) is full.
Change-Id: I0a7267db894e7be4216a346752d299132df9a29a
Closes-Bug: #1689694
The api.glance.image_list_detailed() function accepts a list of
filters which it then translates into a form that is acceptable for
Glance v1 or Glance v2. These translations included support for
mapping 'is_public' to 'visibility', but did not include support for
mapping 'property-owner_id' to 'owner'.
This changes adds support for mapping 'property-owner_id' to 'owner'
for Glance v2, and mapping 'owner' to 'property-owner_id' for Glance
v1.
Before this fix, "rebuild instance" from the instances page did not
properly list project-specific images as options. After this fix,
"rebuild instance" is working as expected.
Change-Id: Ica750f8b36bdbadd02a81aed41fd250864a49a66
Closes-Bug: 1671693
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.
After this, there are only 3 noqa under openstack_dashboard/ :)
Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
Even if Horizon is configured to use internal endpoints for requests
made by its server side to other OpenStack services, the client side
should not be restricted to run only in networks which have access to
the internal endpoints.
Change-Id: Ibdc663a133670e8f07530c0d7c5ed7df2d92b99b
Closes-Bug: #1639080
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
Implements wrappers necessary for Horizon to work with either Glance
v1 or v2 and removes the dependency on the Glance v1 endpoint.
Handles the differences between setting properties with v1 and v2 and
restricts some Glance functions that aren't supported in v2.
Implements blueprint: horizon-glance-v2
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Brad Pokorny <Brad_Pokorny@symantec.com>
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Co-Authored-By: Liuqing Jing <jing.liuqing@99cloud.net>
Change-Id: Icca91c53eabf18c3109b3931ed53f70eaaaa0e56
In case 'data' image attribute is a base string (instead of in-memory
or on-disk file), api.glance sends back an image wrapper with a redirect
url and a token to its caller, so the caller could upload the file to
that url directly.
Provide a unit test for api.glance behavior when an external upload
location is used. That also requires to fix glance stub endpoint data
in keystone_data.py since it didn't reflect the reality.
Also document the new HORIZON_IMAGES_UPLOAD_MODE setting that will
govern direct images upload and the define approach to deprecating the
old HORIZON_IMAGES_ALLOW_UPLOAD setting. The old setting is deprecated
as of Newton release and planned to be removed in P. 'Removing' means
that it will no longer be used / referenced at all in code, not the
actual presence in settings.py (it is removed from settings.py in this
commit). What really matters is if the customized value of
HORIZON_IMAGES_ALLOW_UPLOAD in local_settings.py will be still
considered during the deprecation period.
Help text in Django Create Image form in case if local file upload was
enabled was wrong, fixed that.
Related-Bug: #1403129
Partially implements blueprint: horizon-glance-large-image-upload
Change-Id: I24ff55e0135514fae89c20175cf9c764e871969b
Move most of the pagination-logic to `api.glance.image_list_detailed`,
thus making code in Admin/Project->Images->get_data() less confusing
(and remove hard-coded 'asc'|'desc' values).
Also prepare to get images both from glanceclient.v1 and
glanceclient.v2 (which doesn't set `is_public` attr on images using
`visibility` attr instead).
Change-Id: Ibe6d3dd1e94a1d1fbf95382599a5f53c3559ce5a
Closes-Bug: #1534670
Closes-Bug: #1336317
This allows specifying a properties target when fetching metadata
definitions namespaces from glance, and updates the instance
metadata widget to show only "metadata" properties (as opposed to
"scheduler_hints") when creating an instance or updating the
metadata.
Closes-Bug: #1537842
Change-Id: I64dd279139eca2cbd0c0a6e808ade4cbcba8df95
Adding REST API calls for use in the new angularized
panels for Metadata definitions.
Set DISABLED = False in
openstack_dashboard/enabled/_2131_admin_metadata_defs_panel.py
Change-Id: I08c9c05a7b0870160ede7eb7645fc9daa83e2dd5
Partially-Implements: blueprint ng-metadata-defs-panel
Misspelling in the message:
"some time and is handed off to a seperate thread."
Should be "some time and is handed off to a separate thread."
Totally 1 occasion in horizon base code.
Change-Id: I7a67c050c503c6fc7211f5191ea56bc0e8f6cb98
The best practice in Python is not to use mutable object (i.e. list,
dictionary, or instances of most classes) as value of default
argument (see https://goo.gl/Kwhg0T). A hacking rule to enforce this
practice is added as well.
The patch was inspired by CR https://review.openstack.org/#/c/198465/
and took most of its code from it as well. That's why original
copyrights are kept.
Closes-Bug: #1471349
Change-Id: Ia77b1736dbc3d4e28ff2d2c3424e9cfcaefa5077
Listing metadata definitions namespaces requires glance API version
2. This adds a check that makes sure an empty array is returned if
any version less than 2 is being used.
Closes-Bug: #1516711
Partially-Implements: blueprint horizon-glance-v2
Change-Id: Ifc0a091318296da06168f9701a280eb7357632c7
This is needed to check if Image Metadata can be
updated.
Change-Id: I23f8b84f5f72a6423b0c453413faef25f2e139d2
Partially-Implements: blueprint angularize-images-table
Before an UnboundLocalError would occur in case an error would happen
during image updates, because of incorrect referencing of a variable.
Moreover the error was muted by exceptions.handle with ignore=True,
and could result in an incorrect success message.
This change removes references to unused image variable and allows
exceptions to be handled by the function, that calls image_update.
Change-Id: I35ea98a146690565582dd9beea62941f97d32474
Closes-Bug: #1464991