Commit Graph

9 Commits

Author SHA1 Message Date
Hervé Beraud 336f71083e Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I0461cbe800396d5406a28db50ee03aeb9468f923
2020-06-02 20:05:28 +02:00
Ryan Beisner bba9749806 Update requirements
Also remove tests/charm-helpers if present, in favor
of the pip-installed charm-helpers.

Change-Id: I1ac0cbf16711fb6e93c42b2b25e010cf0876a98d
2018-10-04 16:44:02 -05:00
Alex Kavanagh 8bb5ade02f Use charms.openstack charmhelpers test_mocks
Every reactive charm that uses charms.openstack and implements unit
testing needs to mock charmhelpers, as otherwise the tests blow up.
This patch uses the mocking of charmhelpers in charms.openstack so that
a charm layer can just import test_mocks and charmhelpers will be mocked
out along with setting up a default
charmhelpers.c.o.u.OPENSTACK_RELEASES so that when an OpenStackCharm()
derived charm class won't fail on definition.

Change-Id: I3dd4954daa24ff16a9da8f2a64290e5013b55301
Related-Bug: #1693017
Depends-On: I5ac40617ee30e5f421ec16fc7592177a5e6aa166
2017-05-25 10:56:42 +01:00
Liam Young 8d638c8d9c Add Keystone v3 support to charm
This change adds Keystone v3 support to the charm. Whether to run
using the keystone v2 or v3 api should be dictated by the
api_version sent down the identity-admin relation but the change
to enable that has not landed yet and it is useful to have this charm
work for v3 against stable charms. To allow this there is some hard
coding of expected v3 credentials that can be removed later. fwiw
this change represents a net reduction in hardcoded creds. changes
include:

1) Fix typo in default floating-network-name ext_net rather that
   ext-net
2) Refactor init_keystone_client to initialise the right client
   depending on api version.
3) Add a keystone_session object which can be shared by the
   individual project clients
4) Use credential information passed down the identity-admin
   relation in the tempest.conf template
5) Disable the ec2 cred checks for keystone v3 as these rely on
   the client being able to resolve users and projects to their
   uuids which does not seem to be possible with a project scoped
   client. This shoud be fixed at a later date by the identity admin
   relation passing the uuids to the charm
6) Remove try/catch-all excepts blocks. They were initially put in
   as the charm tried to render its config as it came up meaning
   that the services it tried to query may have been down. The
   charm no longer does this and a client failure should be fatal.
   Also try/catch-all excepts blocks are a fundamentally bad thing.
   Where needed check that the service is present in the catalogue
   before querying its api.

Change-Id: I3dd5ed610794eece515d9a03391f9844ac83efc0
2017-01-20 11:04:54 +00:00
Liam Young 2d054f6bb9 Explicitly install tox package
Tox is used to run tempest so explicitly install the tox package

Change-Id: Ifc802a7d76208d6f2818e0f2e09e7fc5ad4d7f52
Closes-Bug: 1648493
2016-12-13 09:50:56 +00:00
Liam Young f9100ec85d Add unit tests
Added unit tests and tidy up calls to initialise Keystone client.

Closes-Bug: 1628491
Change-Id: I14ea09539e5781ded75bcfa47108f10e27c816df
2016-12-07 13:06:28 +00:00
Alex Kavanagh f10d28e392 Refactor to source charm
This is in line with the agreed conventions on where to put
files in a layered source package.

Essentially, just the final moving of things around and ensuring
that the dummy tests pass, along with lint.

Change-Id: I392568d6279f0a5876bdb2a3ad5e49fee03734aa
2016-06-15 17:27:33 +00:00
Ryan Beisner 01dfcd927d Add initial no-op unit test structure
This does not actually add unit tests, only an inert
and passing no-op test to unblock initialization of
this repo with regard to layer build and test
automation.

Change-Id: I7102d6f483d7680c4fc99074c5567cbf32cde690
2016-06-03 16:19:37 +00:00
Ryan Beisner e2c90d5828 Prepare repo for gerrit 2016-06-01 20:17:19 +00:00