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
Status: Merged
Approved by: Guillermo Gonzalez
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 Approve
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.
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
=== added file 'hooks/nrpe-external-master-relation-joined'
--- hooks/nrpe-external-master-relation-joined 1970-01-01 00:00:00 +0000
+++ hooks/nrpe-external-master-relation-joined 2015-10-01 21:43:16 +0000
@@ -0,0 +1,13 @@
1#!/usr/bin/env python
2
3from charmhelpers.core import hookenv
4
5
6def nrpe_external_master_relation_joined():
7 '''Set us as the primary relation'''
8 rel_id = hookenv.relation_id()
9 hookenv.relation_set(rel_id, primary=True)
10
11
12if __name__ == '__main__':
13 nrpe_external_master_relation_joined()

Subscribers

People subscribed via source and target branches