Merge lp:~barryprice/charms/xenial/daisy-retracer/trunk into lp:~daisy-pluckers/charms/xenial/daisy-retracer/trunk

Proposed by Barry Price
Status: Merged
Merged at revision: 213
Proposed branch: lp:~barryprice/charms/xenial/daisy-retracer/trunk
Merge into: lp:~daisy-pluckers/charms/xenial/daisy-retracer/trunk
Diff against target: 14 lines (+4/-0)
1 file modified
hooks/common (+4/-0)
To merge this branch: bzr merge lp:~barryprice/charms/xenial/daisy-retracer/trunk
Reviewer Review Type Date Requested Status
Daisy Pluckers Pending
Review via email: mp+400239@code.launchpad.net

Commit message

Ensure nrpe relation actually has a unit ID before attempting to use it

Seen deploying a couple of new units recently, when RELATION_ID was defined, but a relation-list didn't yet return any units:

+ nrpe_setup
++ relation-ids nrpe-external-master
+ RELATION_ID=nrpe-external-master:193
+ '[' -z nrpe-external-master:193 ']'
++ relation-list -r nrpe-external-master:193
+ relation_unit=
++ relation-get -r nrpe-external-master:193 nagios_host_context
ERROR no unit or application specified
+ nagios_host_context=

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/common'
--- hooks/common 2020-06-09 01:54:06 +0000
+++ hooks/common 2021-03-26 09:45:25 +0000
@@ -310,6 +310,10 @@
310 return 0310 return 0
311 fi311 fi
312 relation_unit=$(relation-list -r $RELATION_ID)312 relation_unit=$(relation-list -r $RELATION_ID)
313 if [ -z "$relation_unit" ]; then
314 echo "No nrpe-external-master relation unit yet. Skipping nrpe setup"
315 return 0
316 fi
313 nagios_host_context=$(relation-get -r $RELATION_ID nagios_host_context $relation_unit)317 nagios_host_context=$(relation-get -r $RELATION_ID nagios_host_context $relation_unit)
314 export NAGIOS_HOSTNAME=$(relation-get -r $RELATION_ID nagios_hostname $relation_unit)318 export NAGIOS_HOSTNAME=$(relation-get -r $RELATION_ID nagios_hostname $relation_unit)
315 export INSTANCE_TYPE319 export INSTANCE_TYPE

Subscribers

People subscribed via source and target branches

to all changes: