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

+ 2
- 2
interface.yaml 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

+ 4
- 5
provides.py 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')


+ 3
- 4
requires.py 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')


Loading…
Cancel
Save