Initial commit

This commit is contained in:
Liam Young 2019-03-12 18:13:13 +00:00
commit eb7291590b
4 changed files with 34 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.tox
.testrepository

3
interface.yaml Normal file
View File

@ -0,0 +1,3 @@
name: pacemaker-remote
summary: Basic pacemaker-remote interface
version: 1

24
provides.py Normal file
View File

@ -0,0 +1,24 @@
import base64
from charms.reactive import Endpoint
class PacemakerProvides(Endpoint):
def publish_info(self, stonith_hostname=None):
"""
Publish the stonith info
"""
for relation in self.relations:
relation.to_publish['stonith-hostname'] = stonith_hostname
def get_pacemaker_key(self):
for relation in self.relations:
pacemaker_keys = []
for unit in relation.units:
pacemaker_keys.append(unit.received['pacemaker-key'])
unique_keys = len(set(pacemaker_keys))
if unique_keys > 1:
raise Exception("Inconsistent keys")
elif unique_keys == 1:
return base64.decode(unique_keys[0])
return None

5
requires.py Normal file
View File

@ -0,0 +1,5 @@
from charms.reactive import Endpoint
class PacemakerRequires(Endpoint):
pass