Merge lp:~thedac/charms/precise/nrpe-external-master/one-to-many into lp:charms/nrpe-external-master

Proposed by David Ames
Status: Merged
Approved by: Tom Haddon
Approved revision: 26
Merged at revision: 24
Proposed branch: lp:~thedac/charms/precise/nrpe-external-master/one-to-many
Merge into: lp:charms/nrpe-external-master
Diff against target: 33 lines (+16/-2)
2 files modified
hooks/config-changed (+15/-1)
revision (+1/-1)
To merge this branch: bzr merge lp:~thedac/charms/precise/nrpe-external-master/one-to-many
Reviewer Review Type Date Requested Status
Tom Haddon Approve
charmers Pending
Review via email: mp+182426@code.launchpad.net

Commit message

Allow one nrpe-external-master to many service charms

Description of the change

Allow one nrpe-external-master to many service charms

To post a comment you must log in.
25. By David Ames

[dames,trivial] Add empty relation variable for non-relation hooks

26. By David Ames

[rfinnie,r=dames] Allow charms without an nrpe-external-master hook to get the basic checks

Revision history for this message
Tom Haddon (mthaddon) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/config-changed'
2--- hooks/config-changed 2012-11-26 04:29:01 +0000
3+++ hooks/config-changed 2013-08-30 23:20:16 +0000
4@@ -53,7 +53,21 @@
5 #------------------------------------------------------
6 # Host check
7 #------------------------------------------------------
8-export NAGIOS_HOSTNAME="$(config-get nagios_host_context)-$(relation-list -r $(relation-ids nrpe-external-master))"
9+# Handle nrpe-external-master one to many
10+# The relation that is set will have the relation information
11+# others will be blank
12+RELATION=''
13+RELATION_IDS=$(relation-ids nrpe-external-master)
14+for id in $RELATION_IDS; do
15+ RELATION=$(relation-list -r $id)
16+ if [ -n "$RELATION" ]; then
17+ break
18+ fi
19+done
20+if [ -z "$RELATION" ]; then
21+ RELATION="$JUJU_UNIT_NAME"
22+fi
23+export NAGIOS_HOSTNAME="$(config-get nagios_host_context)-${RELATION}"
24 export NAGIOS_HOSTNAME=${NAGIOS_HOSTNAME//\//-}
25 export IPADDRESS=$(unit-get private-address)
26 export HOSTCHECK_INHERIT=$(config-get hostcheck_inherit)
27
28=== modified file 'revision'
29--- revision 2012-10-26 07:10:22 +0000
30+++ revision 2013-08-30 23:20:16 +0000
31@@ -1,1 +1,1 @@
32-5
33+7

Subscribers

People subscribed via source and target branches

to all changes: