41 Commits

Author SHA1 Message Date
Akihiro Motoki
af3b7e4134 flake8-import-order: Ensure to place project imports last
To ensure project imports are placed after third party import,
we need to specify application-import-names.
Previously flake8-import-check checks only standard imports or not.

Change-Id: I9beb2105f686dc7d9aebfce8e21c5e182698e2fe
2017-09-20 01:19:38 +00:00
Akihiro Motoki
b9d0243c33 Fix H405 (multi line docstring) warnings (openstack_dashboard)
H405: multi line docstring summary not separated with an empty line

Closes-Bug: #1696996

Change-Id: Id895695663b19522d9cdc22f8b012e49680d708b
2017-06-09 16:05:31 +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
Radomir Dopieralski
7be8078910 Consistently hash Version objects
The semantic_version.Version objects don't properly support hashing,
so we need to handle that in our wrapper, so that the "in" operator
can work properly with sets and dicts.

Closes-Bug: #1649819
Change-Id: I85e2b2214546817ef4da136b7d4267985ced94dc
2017-03-09 19:32:21 +01:00
Jenkins
834722cf8a Merge "Properly compare versions in APIVersionManager" 2017-03-02 20:53:15 +00:00
liaozd
60db0269e0 wrong indentations
Change-Id: I967fbe1e1e92851f1ca330cf43b00fc1d65e5b36
Closes-Bug: 1657450
2017-01-30 16:51:48 +00:00
Radomir Dopieralski
8377fb9e18 Properly compare versions in APIVersionManager
Since the APIVersionManager stored the version numbers as ints and
floats, it was not possible to distinguish between version 1.2 and 1.20,
and also version 1.2 would be considered higher than version 1.13. With
the introduction of microversioning in some services, the version
numbers inflate quickly, making this a problem.

This patch wraps the version numbers in a Version object, that stores
the information as a semantic_version and correctly compares with other
Version objects, as well as ints, floats and strings.

It also removes the check for version being specified as a string, so
that it's possible to specify versions such as 1.20 without having to
explicitly create Version objects.

Change-Id: I0b0d87582d617290f08359ad181216cb99edb768
Closes-Bug: #1649819
2017-01-27 13:43:47 +00:00
Akihiro Motoki
11d973fbe3 Fix network duplication check logic
Previously api.neutron.Network object was compared by using _apidict
but it did not work when for example the order of subnet list is different.
This commit changes the comparison logic to use network ID explicitly.
In addition, it moves the logic to fetch external networks to api.neutron.

Change-Id: Ie3a42e29c32c17a7f3bf1596b0e09cb73eae9d2a
Closes-Bug: #1528465
2016-02-12 16:58:00 +00: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
Yves-Gwenael Bourhis
803209e237 Show external networks
Only shared networks were considered as external.
The Neutron policy since Icehouse is router:external=True and shared=False so
external networks were not seen anymore
We need to be able to see the external network to obtain its ID (e.g. for
heat templates in the orchestration panel).

We now display external networks and added an "external" field in the networks
view

Change-Id: Ice1f4e2c11825b8d86a8a126350e71a88741acb7
Closes-Bug: #1472281
2015-09-30 14:29:36 +00:00
IWAMOTO Toshihiro
232d5ac8fe Simplify is_service_enabled
Remove service_name argument from the is_service_enabled function.
The argument is unused and complicates the function's logic.

Change-Id: I1ac8a037bd7908ef1101d5fec359a8fe0e16e24a
2015-09-14 11:46:20 +09:00
Jenkins
c8f4f5360f Merge "Updated parsing of catalog to handle bad format" 2015-03-31 02:05:33 +00:00
lin-hua-cheng
8d3c2baa5b Updated parsing of catalog to handle bad format
Don't assume that the service catalog is well-formed, added code
to safely parsing the catalog.

Parsing of region from service catalog has been fixed as well.
'region' has been deprecated in the Keystone V3 catalog in favor of
'region_id'. Fix how region is extracted by checking 'region_id' then
fallback to 'region'.

Change-Id: I9e027586847b7b7c0276e8c3ff6b73f06a32e2a5
Closes-Bug: #1424825
2015-03-09 12:47:30 -07:00
Mike Hagedorn
255340c596 REST API to support create instance angular (Neutron).
In this update:
- fixed tests
- fixed exception handling, params on ports
- fixed to_dict for a number of cases
- replaced use of request.DATA with request.GET for GET methods
- added handling of HTTP error raised with no status/code attr
- removed check for network_id in subnets as it's not required
- fix to_dict for Network with Subnets

Supercedes
https://review.openstack.org/#/c/152243
https://review.openstack.org/#/c/151313

Partially Implements: blueprint launch-instance-redesign
Co-Authored-By: Aaron Sahlin <asahlin@us.ibm.com>
Co-Authored-By: Michael Hagedorn <mike.hagedorn@hp.com>
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>

Change-Id: Ia40fde6d66720a03a531b516a6a53a2e86ec0d8f
2015-03-04 07:20:43 -05:00
Travis Tripp
b915760a56 Nova Flavor Server Extensions Rest APIs - Angular
This provide flavor APIs for launch instance work.
This provides extension APIs for launch instance work.
This provides single server get for instance details work.
This provide single flavor get for instance details work.

Partially Implements: blueprint launch-instance-redesign
Partially Implements: blueprint instance-details-redesign

Change-Id: Ia1fd36ec31de21c60801f4d47716ef69aad7525f
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
2015-02-26 16:05:54 +11:00
keshy
aed603d618 Fix typo errors in comments for api modules
Co-Authored-By: Lin Hua Cheng <os.lcheng@gmail.com>

Change-Id: I55327c2e7d44d01c8bc832c1a5228a6b3dc3184f
Closes-Bug: #1268253
2015-02-25 10:50:27 -08:00
Gabriel Hurley
59ad632a68 Quality of life improvements to APIVersionManager
* Verifies that the API version values provided are of the right type
  (currently all version keys are ints or floats, not strings).

* Provides a list of the version keys which would be acceptable if an
  invalid version is provided.

* Raises a useful and explanatory exception if these values are
  incorrect.

* Adds the "preferred" API version to the "supported" versions as
  a convenience during init.

Change-Id: I0bc75b145bba757ff6cd405e1a654aeef296f2df
Closes-Bug: 1411427
2015-01-30 21:53:55 -08:00
liyingjun
7985cfce77 Handle situation when endpoint deleted
when the cinder services exist but endpoint deleted, accessing
to /project/access_and_security will cause an error:
IndexError: list index out of range

Change-Id: Iad7f72cd5247f33245f25a8092c40a4d3a04cef9
Partial-Bug: #1394900
2014-12-01 22:05:00 +08:00
eric
88371c6660 horizon ignores region for identity service
this change will attempt to use a identity service in the selected region
when available.  before the region for the identity service was always the first
found

Change-Id: Idc64a32128bcee561cdbba956722adad0ee1eaf2
Closes-Bug: #1339382
2014-09-17 15:41:54 -06:00
woodm1979
e3bf9c4061 APIDictWrapper getitem lookups fail for non str
The APIDictWrapper class within openstack-dashboards/api/base.py can't
handle the "in" operator correctly.

Also, it will fail if a non-string is passed into it's __getitem__
method. (Which is what is called from a dict lookup.)

The get method also fails on non-strings.

Change-Id: Iaad66d3c6deb81d0570b1a8c6ddf580024fa46e6
Closes-Bug: 1326512
2014-06-04 14:10:29 -06:00
Alex Gaynor
c1b4269443 Fixed several typos in comments
Change-Id: I230414c703cf47d7ec727362c20f1814324a2447
2014-05-24 14:42:14 -05: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
Radomir Dopieralski
20b414db2f Don't lose AttributeError in API Wrappers
Instead of (implicitly) catching the AttributeError, and later
creating and raising a new one, we just re-raise the original
exception. This way all the information from the original is
retained, including the name of the actual object on which it
happened.

Change-Id: Idc0c5a8ed5dfca6a8724e393c220baf9960564ed
Closes-bug: #1274097
2014-02-18 09:30:30 +01: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
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
Rob Raymond
2cdd0bb20e Allow region override for url_for
If region is passed in to url_for use that, otherwise continue
to use the region from the user's session.

Fixes bug #1231171

Change-Id: Ia7d2a4f12a3c0d4d45bb918255184d1736f5bddf
2013-09-25 16:42:12 -06:00
Julie Pichon
3852d1ce19 View and update Neutron project quotas
Also ensure that the correct quota is displayed in the Floating IPs
allocation page (Security & Access panel).

Closes-Bug: #1109140

Change-Id: I30d207fbf149bfbcfefeaddf91af49082b7b1f53
2013-08-27 19:13:10 +01:00
Julie Pichon
fde88906b3 Show Neutron floating IPs quotas on Overview
Display the correct limits and usage when Neutron is in use and the
quotas extension is enabled. If Neutron is enabled but the quotas
extensions is not supported, assume the floating IPs quota is
unlimited (a floating IP quota is expected to exist in other places,
e.g. Security and Access panel)

Because quotas may not be configured or enabled even if the extension
is available, add an 'enable_quotas' setting.

Partial-Bug: #1109140

Change-Id: Id6345f4700f0ff45be8ce8acb69cca0d4e05e14a
2013-08-26 16:39:27 +01: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
Akihiro MOTOKI
a06e263b60 Ignore non-existing attr in APIResourceWrapper __repr__
Fixes bug 1202415

__repr__ was added to APIResourceWrapper in the recent commit,
but it searches all attributes in _attrs list. When an attribute
defined in _attrs actually does not exist, __repr__() fails.
This commit changes __repr__ to ignore non-existing attributes.

Change-Id: Iebaeae78f3763d87f3993ba5c4bbed4c23e84c45
2013-07-25 21:45:17 +09:00
Akihiro MOTOKI
695bf560c0 Neutron Security Group native support
blueprint quantum-security-group

Rule table view
* Add direction and ethertype columns (which are specific to Neutron)
  It may be better to hide "Direction" and "Ether Type" columns
  unless Quantum security group is enabled.
* Merge ip_protocol/from_port/to_port into one column for better view
* Use "::/0" for IPv6 ANY instead of "0.0.0.0/0"
* Rename "Source" column to "Remote".
  (The naming "source" does not fit egress rules)
* Display security group name in the title of rule detail view

Rule creation form
* New arguments 'direction' and 'ethertype' in security_group_rule_create()
* Set the default value of 'direction' to 'ingress' in forms.handle()
* Rename 'ip_protocol' to 'rule_menu' and 'source' to 'remote'
  Note that rule_menu is retrieved from rule.ip_protocol in the unit tests
  since they are tests for custom TCP/UDP/ICMP rules.

Network abstraction layer for security group management
* Move security group methods to api.network
* Add Neutron security group API implementation
* Move base classes for network abstraction to a separate module
  (api/network_base.py) to avoid circulated import between
  api.network and api.nova/api.neutron

Add a configuration parameter to control Neutron security group support
* Neutron security group support is enabled when Neutron is enabled and
  enable_security_group in OPENSTACK_NEUTRON_NETWORK in settings is True.
* Not all neutron plugins support security group, so we need a way
  to control neutron security group is enabled or not.
* It can be determined by supported extension list from Neutron
  and it is a possible future work.

Move get_int_or_uuid to openstack_dashboard/utils/filters.
* get_int_or_uuid is now used in security_group implementation as
  well as floating IP logics.
* In addition the depth of the directory tree becomes longer and
  it is hard to fit the import line in 80 chars.
  It is a good chance to move it to a common directory.

Add __repr__ to API**Wrapper to make it easier to debug.

Limitations:
Neutron supports per-port security group. security groups can be
associated with a port instead of an instace and each port can have
a different set of security groups. It is not a scope of this BP
and is a future work.

Change-Id: I5410e88043a364596037b9ebcc566cd50b317614
2013-07-12 21:03:40 +09:00
Jenkins
d511d64edc Merge "Enable hacking H101 test" 2013-06-25 08:20:01 +00:00
Sergey Lukjanov
d4ada3e555 Enable hacking H101 test
H101  Use TODO(NAME)

Change-Id: Ic30decbf72ac43845bf5b24fe4eead341bf1d2d5
2013-06-24 12:56:15 +04:00
David Lyle
917591428e Region selector enabling multi-region support.
This patch adds a region selector dropdown
at the top of both the Project and Admin dashboards if
more than one region is available in the user's service
catalog.  The user is allowed to choose from any region
available in the service catalog. By selecting a region,
the user is limited to accessing endpoints in that
region only as long as the go through api.base.url_for

If there are more than one endpoint for a service in a
region the first in the catalog is returned.  Further
work on the blueprint will handle that complexity.

Supporting Keystone v2.0 and v3 catalog formats.

Partially implements blueprint multiple-service-endpoints

Change-Id: I1ab6539c7c5f4b1ae4b1716059370e86b6ca4d2e
2013-06-20 14:01:10 -06:00
Dirk Mueller
315d30c337 Use Python 3.x compatible except construct
Python 3.x removed the "except x,y:" construct. Use
"except x as y:" instead which works with all
Python versions >= 2.6.

Change-Id: Iedb4c5a6d8580cbb6c9697933d006e94b1db916d
2013-06-14 23:19:28 +02:00
David Lyle
3f19461a80 Refactoring url_for to remove admin parameter
Removed unused admin parameter that was unused and removed tests
that were no longer necessary.

Added an option configuration setting SECONDARY_ENDPOINT_TYPE that
will be attempted if the OPENSTACK_ENDPOINT_TYPE does not exist
in the service catalog for the desired service.

The primary use case for this fix is in cloud configurations
where Keystone does not return all endpoint types for each
service, and only does so based on the user's privilege level.

Example use case would be set OPENSTACK_ENDPOINT_TYPE to 'adminURL'
and set SECONDARY_ENDPOINT_TYPE to 'publicURL'.  If adminURL is not
available to the user, then they get the publicURL back.

If SECONDARY_ENDPOINT_TYPE is not set in the settings, then the
current behavior is maintained.

Fixes: bug #1186379

Change-Id: Ieefb6ed5dd88e5c840ef6bad93ae87237a1b63f9
2013-06-04 17:23:50 -06:00
Lin Hua Cheng
3fd58f9f14 Make discovery of version for KS catalog smarter.
Instead of relying on the configuration file for determining how
the catalog should be parsed, make it flexible by inspecting the
structure of the service catalog passed to it.

Fixes bug 1180486

Change-Id: I0c8caf4c8365bf25377ab3a249ac280d8add0f17
2013-05-15 12:45:34 -07:00
Lin Hua Cheng
32f9e5b388 Enable parsing of Identity Service V3 catalog.
In Keystone V3, the service catalog in the token response
has been split into multiple entries per service. This change
checks the version of the Identity Service and performs the
appropriate parsing of the catalog.

Core code for Keystone V3 authentication are in openstack_auth.

TODO: Move to auto-detection of API versions when it is available.

Implements blueprint login-domain-support

Change-Id: I69073e5744def037caf522b1123755668887cfd9
2013-05-09 21:39:09 -07:00
Gabriel Hurley
68a55e3fe8 Enable using multiple API versions for Identity Service.
Introduces a mechanism for switching between API versions,
and implements it in a proof-of-concept fashion for the
Keystone v3 API. Converts the existing Users and Projects
API methods to use it.

This changed some method signatures, and therefore altered
a number of views and tests. However, all code related to
the version cahnges is contained in the api.keystone module.
This seems like a sane process going forwards.

Future TODOs are marked in the code, including auto-detection
of API versions and better endpoint URL construction.

Partially implements blueprint api-capability-detection

Change-Id: Ied04200fe6c257aac2241d36628965a3bb6658b9
2013-05-01 18:19:36 -07:00
Gabriel Hurley
cdcd8e3df6 Enable quota data from multiple sources.
Now that there are multiple projects with quota data (cinder, quantum)
we need to accommodate that data being aggregated in a centralized
fashion. This commit takes care of that for nova + cinder, and paves
the way for quantum later.

Fixes bug 1070022.

Change-Id: Ifc68c2dc681b2a7b4e7787e0b1a7dca1a970fc36
2012-10-24 12:53:42 -07: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