Commit Graph

21 Commits

Author SHA1 Message Date
Akihiro Motoki cd7c1b5110 Address RemovedInDjango40Warning (2)
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
2022-02-04 16:22:07 +09:00
Akihiro Motoki e5d09edc20 Use python3-style super()
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
2020-10-15 14:37:20 +09:00
manchandavishal be461acd6f Cleanup for Refactor-error-messages
This patch is a clean-up patch for refactor-error-messages bp
which remove the exception message from base message otherwise
the same exception message display twice like
this https://ibb.co/XyFWMdz .

Partially-Implements blueprint refactor-error-messages

Change-Id: I46b632dbb6701785e7d654feff336a27d6ecea9c
2020-09-04 10:39:11 +00:00
Ivan Kolodyazhny d870b40583 Remove six usage from openstack_dashboard package
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
2020-01-15 12:47:48 +02:00
Akihiro Motoki ec970fd6e8 Handle partial dict setting
In Train cycle, we moved the definition of default values
to openstack_dashboard/defaults.py. The current code accesses
a dict member using []. It requires operators to define a dict
setting with a full member.

This commit allows to use dict-type settings with partial members.

A new function is introduced to retrieve a dict-type setting
considering default values defined in
{openstack_dashboard,horizon,openstack_auth}/defaults.py

Change-Id: I7ff0ad4bca698aef9c0eba370b0570200a14367a
Closes-Bug: #1843104
2019-09-26 14:31:17 +09:00
Zuul 1724818f71 Merge "Allow creating ICMPV6 rules" 2019-07-25 16:13:06 +00:00
Radomir Dopieralski d5dcf1be93 Allow creating ICMPV6 rules
Right now, even if we specify a ::/0 (or other IPv6) CIDR in an
ICMP rule, Horizon sets 'icmp' as the ip_protocol of that rule but
neutron expects 'ipv6-icmp' which is the right ip_protocol for ICMPv6.
This results in that rule never matching anything.

This change makes Horizon set the ip_protocol to ipv6-icmp when
the CIDR is an IPv6 one, and icmp when it's IPv4.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I1f68e1e5a3e073e38ac258de5ed9c43f8acb04e9
Closes-Bug: #1652619
2019-07-24 06:21:36 +09:00
Akihiro Motoki fcdc67b819 Define default settings explicitly (openstack_dashboard 3/5)
This commit mainly covers settings
in openstack_dashboard/dashboards/project/.

Part of blueprint ini-based-configuration
Change-Id: I22413d2fe20576a507634dc4e2d0354c7db8800a
2019-07-03 14:54:16 +09:00
pengyuesheng cf9def203c Marking CIDR as mandatory field on Add rule form in security_group panel
When selecting the remote as CIDR,
the CIDR value field is mandatory but isn't marked as mandatory.
This patch marks it as mandatory.

Change-Id: I2125813d6fb58e311b6bef821a88c78ab0fc6cfc
Closes-Bug: #1816330
2019-04-08 09:33:54 +08:00
Akihiro Motoki 7c585e2643 pylint: fix some refactor recommendations
openstack_dashboard/dashboards/project/security_groups/forms.py:393:13: R1714: Consider merging these comparisons with "in" to "rule_menu in ('tcp', 'udp')" (consider-using-in)
openstack_dashboard/api/rest/json_encoder.py:61:15: R0124: Redundant comparison - o != o (comparison-with-itself)
openstack_dashboard/api/keystone.py:904:15: R1714: Consider merging these comparisons with "in" to 'default in (role.id, role.name)' (consider-using-in)
horizon/templatetags/truncate_filter.py:30:7: R1716: Simplify chained comparison between the operands (chained-comparison)

Change-Id: I6cf8602f88c4027ff12aaa4ea5a9f2069ae2e2a6
2019-01-17 00:44:19 +09:00
Samuel12321 6f37943af9 A description can now be added to a security rule
This patch fixes Bug #1742332 (Security Rule Description neither
editable nor shown). I have added the option for a description
to be added to a security rule which will show the description
on the related table.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ie723deb412977ae460c1e897f5d71fc8dbb7a853
Closes-Bug: #1742332
2018-04-10 00:48:30 +09:00
Akihiro Motoki f8196331ea Add asterisk to conditionally required fields
https://review.openstack.org/#/c/552247/ introduced a way to
add asterisk mark to conditionally required fields.

This commit covers several known forms:
- Create Network / Create Subnet
- Create Port
- Attach Interface to Instance
- Add Security Group Rule

Change-Id: I809c23fd64dc2f379c3fdb585741c6b266ec5b1b
Closes-Bug: #1420370
Closes-Bug: #1292165
Closes-Bug: #1755131
2018-03-22 08:49:58 +09:00
Akihiro Motoki e477eafa45 django2: Replace django.core.urlresolves with django.urls
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3

blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
2018-02-17 01:36:48 +09:00
Akihiro Motoki c6c24eda59 Make icmp_type/code optional
In Neutron API icmp_type/code are not required fields,
so they should be optional.

Previously we support Nova API which requires icmp_type
and icmp_code but we dropped Nova security group API support in Pike
and we no longer need to care it.

Change-Id: Ie460e763928b4f50f84c38d88556df632078ba42
Closes-Bug: #1712025
2017-08-21 10:30:59 +00:00
Akihiro Motoki 9067ae8b0f Move SG and FIP API wrapper to api.neutron
We no longer need to have SG and FIP API wrapper in api.network
as we only supports a single network back-end.

Completes blueprint drop-nova-network

Change-Id: I4e59d897508b497a3cd2ae2fda93b30b786610dc
2017-06-04 17:51:25 +00:00
Akihiro Motoki 07f964c42e Drop Nova security group dependency from dashboard
This commit drops Nova security group dependency from
the dashboard implementation.

security group support in the nova API wrapper will be dropped
in a separate patch.

Also removes api.network.security_group_backend()
as it is no longer needed.

Partially implement blueprint drop-nova-network

Change-Id: I224010eb59068a7cc4f97c2453d499adde7644b4
2017-04-28 08:28:41 +00:00
Yves-Gwenael Bourhis 87337ff255 Allow any port or protocol in security group rules
Neutron allows setting port or protocol wildcard by not specifying any value
for them.

Example, these are allowed by neutron:

    neutron security-group-rule-create --direction egress <sgid>
    neutron security-group-rule-create --direction egress --protocol tcp <sgid>

Specifying '-1' for IP protocol means a wildcard IP protocol.
validate_ip_protocol is updated accordingly.

'All ports' choice is added to 'Open Port' field.

Change-Id: I4a7262eda89e3206c743fee14c78aa6b49308ce6
Closes-Bug: 1669467
2017-03-29 04:53:02 +00:00
Jenkins e3cd250a81 Merge "hacking: noqa cleanup in openstack_dashboard" 2017-03-27 05:11:18 +00:00
Akihiro Motoki baa4ca8dce hacking: noqa cleanup in openstack_dashboard
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
2017-03-17 19:38:47 +00:00
Kenji Ishii 00173dc3c8 Use ThemableSelectWidget for themable
Some places are not using ThemableSelectWidget, so
these select ui is not themable. This patch fix it.

Change-Id: I303a9cf8c6f8f651edf68973a2f5e16a8b04b26d
Closes-bug: #1669696
2017-03-14 12:47:56 +00:00
Rob Cresswell e2698063e2 Move Security Groups into its own panel
This patch moves the Security Groups tab from the Access and Security
panel into its own panel under the Network panel group. As this is the
last tab in Access and Security, that panel is also removed by this
patch.

Change-Id: Id29c7ce635d46383742aec140def265d4b249aa5
Implements: blueprint reorganise-access-and-security
2017-02-02 13:19:21 +11:00