Merge lp:~verterok/charms/trusty/tanuki-result-enum-worker/set-as-nrpe-primary into lp:~tanuki/charms/trusty/tanuki-result-enum-worker/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 42
Merged at revision: 42
Proposed branch: lp:~verterok/charms/trusty/tanuki-result-enum-worker/set-as-nrpe-primary
Merge into: lp:~tanuki/charms/trusty/tanuki-result-enum-worker/trunk
Diff against target: 17 lines (+13/-0)
1 file modified
hooks/nrpe-external-master-relation-joined (+13/-0)
To merge this branch: bzr merge lp:~verterok/charms/trusty/tanuki-result-enum-worker/set-as-nrpe-primary
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+273177@code.launchpad.net

Commit message

Add nrpe-external-master-relation-joined hook to set the service unit as the primary relation

Description of the change

Add nrpe-external-master-relation-joined hook to set the service unit as the primary relation

This is needed to avoid the race between the main charm and conn-check subordinate in the nrpe relation (nrpe subordinate will pickup the first relation, if none is defined as the primary)

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'hooks/nrpe-external-master-relation-joined'
2--- hooks/nrpe-external-master-relation-joined 1970-01-01 00:00:00 +0000
3+++ hooks/nrpe-external-master-relation-joined 2015-10-02 04:11:48 +0000
4@@ -0,0 +1,13 @@
5+#!/usr/bin/env python
6+
7+from charmhelpers.core import hookenv
8+
9+
10+def nrpe_external_master_relation_joined():
11+ '''Set us as the primary relation'''
12+ rel_id = hookenv.relation_id()
13+ hookenv.relation_set(rel_id, primary=True)
14+
15+
16+if __name__ == '__main__':
17+ nrpe_external_master_relation_joined()

Subscribers

People subscribed via source and target branches