Browse Source

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
changes/80/515380/2
Alex Kavanagh 2 years ago
parent
commit
9b0199a547
3 changed files with 7 additions and 3 deletions
  1. +1
    -0
      .gitignore
  2. +4
    -1
      src/layer.yaml
  3. +2
    -2
      unit_tests/test_lib_barbican_softhsm.py

+ 1
- 0
.gitignore View File

@@ -5,3 +5,4 @@ interfaces
trusty
.testrepository
__pycache__
.stestr

+ 4
- 1
src/layer.yaml View File

@@ -1,3 +1,6 @@
includes: ['layer:openstack', 'interface:barbican-hsm']
repo: https://github.com/openstack/charm-barbican-softhsm

options:
basic:
use_venv: true
include_system_packages: true

+ 2
- 2
unit_tests/test_lib_barbican_softhsm.py View File

@@ -47,8 +47,8 @@ class TestSoftHSM(test_utils.PatchHelper):
# test with no file (patch open so that it raises an error)
mock_open = mock.MagicMock(return_value=mock.sentinel.file_handle)
with mock.patch('builtins.open', mock_open):
def raise_exception():
raise Exception("Supposed to break")
def raise_exception(*args):
raise OSError("Supposed to break")
mock_open.side_effect = raise_exception
pin, so_pin = softhsm.read_pins_from_store()
self.assertEqual(pin, None)


Loading…
Cancel
Save