From bca864f33f363f4c56ee4a1910a98a4efff4e437 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Fri, 1 Mar 2019 11:13:05 +0000 Subject: [PATCH] Support hacluster using peer-availability relation Add support for the hacluster charm to be related to a principle using the juju-info interface using the peer-availability relation. This is useful in the situation where a cluster without any resources is needed. Change-Id: Ibd03ba7923cfd2c412d5f772cf385a21c423e5af --- hooks/hooks.py | 4 +++- hooks/peer-availability-relation-changed | 1 + hooks/peer-availability-relation-joined | 1 + metadata.yaml | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) create mode 120000 hooks/peer-availability-relation-changed create mode 120000 hooks/peer-availability-relation-joined diff --git a/hooks/hooks.py b/hooks/hooks.py index 2d73a59..ed7d50c 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -229,6 +229,8 @@ def hanode_relation_joined(relid=None): @hooks.hook('ha-relation-joined', 'ha-relation-changed', + 'peer-availability-relation-joined', + 'peer-availability-relation-changed', 'hanode-relation-changed') def ha_relation_changed(): # Check that we are related to a principle and that @@ -253,7 +255,7 @@ def ha_relation_changed(): level=INFO) return - relids = relation_ids('ha') + relids = relation_ids('ha') or relation_ids('juju-info') if len(relids) == 1: # Should only ever be one of these # Obtain relation information relid = relids[0] diff --git a/hooks/peer-availability-relation-changed b/hooks/peer-availability-relation-changed new file mode 120000 index 0000000..9416ca6 --- /dev/null +++ b/hooks/peer-availability-relation-changed @@ -0,0 +1 @@ +hooks.py \ No newline at end of file diff --git a/hooks/peer-availability-relation-joined b/hooks/peer-availability-relation-joined new file mode 120000 index 0000000..9416ca6 --- /dev/null +++ b/hooks/peer-availability-relation-joined @@ -0,0 +1 @@ +hooks.py \ No newline at end of file diff --git a/metadata.yaml b/metadata.yaml index d3d56f3..6c256f5 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -15,6 +15,9 @@ requires: juju-info: interface: juju-info scope: container + peer-availability: + interface: juju-info + scope: container provides: ha: interface: hacluster