Merge lp:~brad-marshall/charms/precise/nrpe-external-master/fix-lxc-nagios-hostname-type into lp:charms/nrpe-external-master

Proposed by Brad Marshall
Status: Merged
Approved by: Chris Stratford
Approved revision: 34
Merged at revision: 34
Proposed branch: lp:~brad-marshall/charms/precise/nrpe-external-master/fix-lxc-nagios-hostname-type
Merge into: lp:charms/nrpe-external-master
Diff against target: 17 lines (+6/-1)
1 file modified
hooks/config-changed (+6/-1)
To merge this branch: bzr merge lp:~brad-marshall/charms/precise/nrpe-external-master/fix-lxc-nagios-hostname-type
Reviewer Review Type Date Requested Status
Chris Stratford (community) Approve
Review via email: mp+237553@code.launchpad.net

Description of the change

Fixes an issue with the nagios hostname being empty if hostname --fqdn errors out, which can happen with LXCs or other oddness with DNS.

To post a comment you must log in.
Revision history for this message
Chris Stratford (chris-gondolin) wrote :

Looks good to me

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 2014-05-27 10:36:57 +0000
3+++ hooks/config-changed 2014-10-08 07:58:31 +0000
4@@ -94,7 +94,12 @@
5 RELATION="$JUJU_UNIT_NAME"
6 fi
7 if [ "$NAGIOS_HOSTNAME_TYPE" = "host" ]; then
8- export NAGIOS_HOSTNAME=$(hostname --fqdn)
9+ if hostname --fqdn>/dev/null; then
10+ export NAGIOS_HOSTNAME=$(hostname --fqdn)
11+ else
12+ export NAGIOS_HOSTNAME=$(hostname)
13+ fi
14+
15 else
16 export NAGIOS_HOSTNAME="$(config-get nagios_host_context)-${RELATION}"
17 export NAGIOS_HOSTNAME=${NAGIOS_HOSTNAME//\//-}

Subscribers

People subscribed via source and target branches

to all changes: