Commit Graph

7 Commits

Author SHA1 Message Date
Hervé Beraud 58bd3ee914 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: Iaf0edaa9d520923d15d0d897b0084f6b7a2cf10a
2020-06-02 19:37:04 +02:00
Alex Kavanagh 9b0199a547 Ensure that venv is used
This is to ensure that the charm doesn't trample on the system packages
for the things that it needs to install, and that it will cooperate with
another reactive charm, especially as it is a subordinate.

Also fix some PEP8 E722 errors as that seems to have been added to the
pep8 standard set.

Change-Id: I9efb78c6f738db2284677dbde85f9e2a3ed0a6fe
2017-11-17 10:33:04 +00:00
Alex Kavanagh 19c2f95d30 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: I84eccd82f095c5c379c6d9850d266f38f589a4a4
Related-Bug: #1693017
Depends-On: I5ac40617ee30e5f421ec16fc7592177a5e6aa166
2017-05-24 20:50:38 +01:00
Alex Kavanagh b00cb733a8 Fix func27-smoke which fails
This was a combination of the smoke test being incorrectly specified
and there being no assess_status() at the end of the hsm_connected()
function.  Also the assess_status() was removed from the layer-openstack
which meant that the status wasn't updating.

The change adds in an assess_status() call, but also reworks the tests
so that they use the new features in charms.openstack, and also uses
defaults for config-changed and assess-status hooks/events.

The gate that tox.ini is the keystone-v2 version of the tests.

Change-Id: Ib8082a083b05eba872d8a2e5fe477352df25ccbb
Closes-Bug: #1629624
2016-10-05 17:40:42 +00:00
Ryan Beisner bb82897cda Add .gitreview and clean up repo
Update tox.ini to lint unit_tests, clean lint.

Add src/README.md placeholder to prevent inheritence of the
lower layer readme file in the built charm.

Add src/tox.ini and test-requirements for Amulet prep.

Update metadata.yaml for series.

Update tox.ini to minimize and clarify pep8 ignores.

Resolve flake8/pbr test-requirements version range conflict.

Mock apt in unit tests.

Add required tags data in src/metadata.yaml for charm proof.

Use openstack/charms.openstack proper in test-requirements
instead of a user space fork.

Update src/layer.yaml repo value to point to official location
and remove unnecessary options.

Change-Id: I5ca9e6cf9f8f91b3ce0ec3b48cf63535ca37c0f7
2016-08-03 18:59:01 +00:00
Alex Kavanagh f8b5939ba9 Renamed the softhsm_plugin to softhsm
This is part of a rename strategy to remove the word 'plugin' from the charm.

Also changed the charm so that it runs in a venv for better isolation.
2016-07-13 14:09:37 +00:00
Alex Kavanagh 45e370b142 Charm with unit tests
Working charm with unit tests. Various features:

Change the install ownership for token store

It turns out that the 'user' that creates the token store, is the only one that
can access it, apart from root.  As Barbican uses a 'barbican' user for the
barbican-worker process, we need to create the token store with 1777 perms (see
https://github.com/opendnssec/SoftHSMv2/issues/185) and also create the initial
token using the barbican user.

Add an initial README.md: This describes the charm, where to get help
and how to use it.
2016-07-12 16:53:46 +00:00