Initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.tox
|
||||||
|
.testrepository
|
3
interface.yaml
Normal file
3
interface.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
name: pacemaker-remote
|
||||||
|
summary: Basic pacemaker-remote interface
|
||||||
|
version: 1
|
24
provides.py
Normal file
24
provides.py
Normal 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
5
requires.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from charms.reactive import Endpoint
|
||||||
|
|
||||||
|
|
||||||
|
class PacemakerRequires(Endpoint):
|
||||||
|
pass
|
Reference in New Issue
Block a user