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.
This commit is contained in:
Alex Kavanagh 2016-07-13 14:46:05 +00:00
parent a5ed48a3ad
commit 44c34f7d19
4 changed files with 52 additions and 11 deletions

43
README.md Normal file
View File

@ -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).

View File

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

View File

@ -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')

View File

@ -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')