diff --git a/README.md b/README.md new file mode 100644 index 0000000..d27ad58 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Overview + +This interface supports the integration between Barbican and HSM devices. + +# Usage + +No explicit handler is required to consume this interface in charms +that consume this interface. + +The interface provides `hsm.connected` and `hsm.available` states. + +## For an HSM subordinate charm + +The `hsm.connected` state indicates that the Barbican principle charms has been +connected to. At this point the plugin data required for to configure the HSM +from Barbican should be presented. + +# metadata + +To consume this interface in your charm or layer, add the following to `layer.yaml`: + +```yaml +includes: ['interface:barbican-hsm'] +``` + +and add a provides interface of type `hsm` to your charm or layers +`metadata.yaml`: + +```yaml +provides: + hsm: + interface: barbican-hsm + scope: container +``` + +Please see the example 'Barbican SoftHSM' charm for an example of how to author +an HSM charm. + +# Bugs + +Please report bugs on [Launchpad](https://bugs.launchpad.net/openstack-charms/+filebug). + +For development questions please refer to the OpenStack [Charm Guide](https://github.com/openstack/charm-guide). diff --git a/interface.yaml b/interface.yaml index 61e3155..c12371d 100644 --- a/interface.yaml +++ b/interface.yaml @@ -1,4 +1,4 @@ -name: barbican-hsm-plugin +name: barbican-hsm summary: Interface for a plugin to the Barbican charm. maintainer: OpenStack Charmers -repo: https://github.com/openstack-charmers/charm-interface-barbican-plugin +repo: https://github.com/openstack-charmers/charm-interface-barbican diff --git a/provides.py b/provides.py index bd252d6..2ed86f0 100644 --- a/provides.py +++ b/provides.py @@ -15,11 +15,10 @@ import json import charms.reactive as reactive -import charmhelpers.core.hookenv as hookenv class BarbicanProvides(reactive.RelationBase): - """This is the barbican-{type}hsm-plugin end of the relation + """This is the barbican-{type}hsm end of the relation The HSM provider needs to set it's name (which may be relevant) and also provide any plugin data to Barbican. @@ -38,16 +37,16 @@ class BarbicanProvides(reactive.RelationBase): # with a basic documentation string provided. auto_accessors = [] - @reactive.hook('{provides:barbican-hsm-plugin}-relation-joined') + @reactive.hook('{provides:barbican-hsm}-relation-joined') def joined(self): self.set_state('{relation_name}.connected') self.set_state('{relation_name}.available') - @reactive.hook('{provides:barbican-hsm-plugin}-relation-changed') + @reactive.hook('{provides:barbican-hsm}-relation-changed') def changed(self): pass - @reactive.hook('{provides:barbican-hsm-plugin}-relation-{broken,departed}') + @reactive.hook('{provides:barbican-hsm}-relation-{broken,departed}') def departed(self): self.remove_state('{relation_name}.available') self.remove_state('{relation_name}.connected') diff --git a/requires.py b/requires.py index ea055ab..59dffed 100644 --- a/requires.py +++ b/requires.py @@ -15,7 +15,6 @@ import json import charms.reactive as reactive -import charmhelpers.core.hookenv as hookenv class BarbicanRequires(reactive.RelationBase): @@ -35,16 +34,16 @@ class BarbicanRequires(reactive.RelationBase): # with a basic documentation string provided. auto_accessors = ['_name', '_plugin_data'] - @reactive.hook('{requires:barbican-hsm-plugin}-relation-joined') + @reactive.hook('{requires:barbican-hsm}-relation-joined') def joined(self): self.set_state('{relation_name}.connected') self.update_status() - @reactive.hook('{requires:barbican-hsm-plugin}-relation-changed') + @reactive.hook('{requires:barbican-hsm}-relation-changed') def changed(self): self.update_status() - @reactive.hook('{requires:barbican-hsm-plugin}-relation-{broken,departed}') + @reactive.hook('{requires:barbican-hsm}-relation-{broken,departed}') def departed(self): self.remove_state('{relation_name}.connected') self.remove_state('{relation_name}.available')