Browse Source

Rename the interface to barbican-hsm

It was called barbican-hsm-plugin, but it was decided to rename it to
barbican-hsm.  Also added a README and ensured that the tox -e pep8 target
passes.
changes/01/607901/1
Alex Kavanagh 3 years ago
parent
commit
44c34f7d19
4 changed files with 52 additions and 11 deletions
  1. 43
    0
      README.md
  2. 2
    2
      interface.yaml
  3. 4
    5
      provides.py
  4. 3
    4
      requires.py

+ 43
- 0
README.md View File

@@ -0,0 +1,43 @@
1
+# Overview
2
+
3
+This interface supports the integration between Barbican and HSM devices.
4
+
5
+# Usage
6
+
7
+No explicit handler is required to consume this interface in charms
8
+that consume this interface.
9
+
10
+The interface provides `hsm.connected` and `hsm.available` states.
11
+
12
+## For an HSM subordinate charm
13
+
14
+The `hsm.connected` state indicates that the Barbican principle charms has been
15
+connected to.  At this point the plugin data required for to configure the HSM
16
+from Barbican should be presented.
17
+
18
+# metadata
19
+
20
+To consume this interface in your charm or layer, add the following to `layer.yaml`:
21
+
22
+```yaml
23
+includes: ['interface:barbican-hsm']
24
+```
25
+
26
+and add a provides interface of type `hsm` to your charm or layers
27
+`metadata.yaml`:
28
+
29
+```yaml
30
+provides:
31
+  hsm:
32
+    interface: barbican-hsm
33
+    scope: container
34
+```
35
+
36
+Please see the example 'Barbican SoftHSM' charm for an example of how to author
37
+an HSM charm.
38
+
39
+# Bugs
40
+
41
+Please report bugs on [Launchpad](https://bugs.launchpad.net/openstack-charms/+filebug).
42
+
43
+For development questions please refer to the OpenStack [Charm Guide](https://github.com/openstack/charm-guide).

+ 2
- 2
interface.yaml View File

@@ -1,4 +1,4 @@
1
-name: barbican-hsm-plugin
1
+name: barbican-hsm
2 2
 summary: Interface for a plugin to the Barbican charm.
3 3
 maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
4
-repo: https://github.com/openstack-charmers/charm-interface-barbican-plugin
4
+repo: https://github.com/openstack-charmers/charm-interface-barbican

+ 4
- 5
provides.py View File

@@ -15,11 +15,10 @@
15 15
 import json
16 16
 
17 17
 import charms.reactive as reactive
18
-import charmhelpers.core.hookenv as hookenv
19 18
 
20 19
 
21 20
 class BarbicanProvides(reactive.RelationBase):
22
-    """This is the barbican-{type}hsm-plugin end of the relation
21
+    """This is the barbican-{type}hsm end of the relation
23 22
 
24 23
     The HSM provider needs to set it's name (which may be relevant) and
25 24
     also provide any plugin data to Barbican.
@@ -38,16 +37,16 @@ class BarbicanProvides(reactive.RelationBase):
38 37
     # with a basic documentation string provided.
39 38
     auto_accessors = []
40 39
 
41
-    @reactive.hook('{provides:barbican-hsm-plugin}-relation-joined')
40
+    @reactive.hook('{provides:barbican-hsm}-relation-joined')
42 41
     def joined(self):
43 42
         self.set_state('{relation_name}.connected')
44 43
         self.set_state('{relation_name}.available')
45 44
 
46
-    @reactive.hook('{provides:barbican-hsm-plugin}-relation-changed')
45
+    @reactive.hook('{provides:barbican-hsm}-relation-changed')
47 46
     def changed(self):
48 47
         pass
49 48
 
50
-    @reactive.hook('{provides:barbican-hsm-plugin}-relation-{broken,departed}')
49
+    @reactive.hook('{provides:barbican-hsm}-relation-{broken,departed}')
51 50
     def departed(self):
52 51
         self.remove_state('{relation_name}.available')
53 52
         self.remove_state('{relation_name}.connected')

+ 3
- 4
requires.py View File

@@ -15,7 +15,6 @@
15 15
 import json
16 16
 
17 17
 import charms.reactive as reactive
18
-import charmhelpers.core.hookenv as hookenv
19 18
 
20 19
 
21 20
 class BarbicanRequires(reactive.RelationBase):
@@ -35,16 +34,16 @@ class BarbicanRequires(reactive.RelationBase):
35 34
     # with a basic documentation string provided.
36 35
     auto_accessors = ['_name', '_plugin_data']
37 36
 
38
-    @reactive.hook('{requires:barbican-hsm-plugin}-relation-joined')
37
+    @reactive.hook('{requires:barbican-hsm}-relation-joined')
39 38
     def joined(self):
40 39
         self.set_state('{relation_name}.connected')
41 40
         self.update_status()
42 41
 
43
-    @reactive.hook('{requires:barbican-hsm-plugin}-relation-changed')
42
+    @reactive.hook('{requires:barbican-hsm}-relation-changed')
44 43
     def changed(self):
45 44
         self.update_status()
46 45
 
47
-    @reactive.hook('{requires:barbican-hsm-plugin}-relation-{broken,departed}')
46
+    @reactive.hook('{requires:barbican-hsm}-relation-{broken,departed}')
48 47
     def departed(self):
49 48
         self.remove_state('{relation_name}.connected')
50 49
         self.remove_state('{relation_name}.available')

Loading…
Cancel
Save