Merge lp:~verterok/charms/trusty/tanuki-spec-manager/set-as-nrpe-primary into lp:~tanuki/charms/trusty/tanuki-spec-manager/trunk

Proposed by Guillermo Gonzalez on 2015-10-01
Status: Merged
Approved by: Guillermo Gonzalez on 2015-10-02
Approved revision: 30
Merged at revision: 30
Proposed branch: lp:~verterok/charms/trusty/tanuki-spec-manager/set-as-nrpe-primary
Merge into: lp:~tanuki/charms/trusty/tanuki-spec-manager/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-spec-manager/set-as-nrpe-primary
Reviewer Review Type Date Requested Status
Samuele Pedroni 2015-10-01 Approve on 2015-10-02
Review via email: mp+273145@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.
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-01 21:43:16 +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