← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~aieri/nagios-charm:bug/1843863 into nagios-charm:master

 

Andrea Ieri has proposed merging ~aieri/nagios-charm:bug/1843863 into nagios-charm:master.

Requested reviews:
  Nagios Charm developers (nagios-charmers)

For more details, see:
https://code.launchpad.net/~aieri/nagios-charm/+git/nagios-charm/+merge/378160
-- 
Your team Nagios Charm developers is requested to review the proposed merge of ~aieri/nagios-charm:bug/1843863 into nagios-charm:master.
diff --git a/hooks/install b/hooks/install
index 4d1ff11..f002e46 100755
--- a/hooks/install
+++ b/hooks/install
@@ -31,6 +31,8 @@ echo nagios3-cgi nagios3/adminpassword-repeat password $PASSWORD | debconf-set-s
 DEBIAN_FRONTEND=noninteractive apt-get -qy \
   install nagios3 nagios-plugins python-cheetah python-jinja2 dnsutils debconf-utils nagios-nrpe-plugin pynag python-apt python-yaml
 
+scripts/postfix_loopback_only.sh
+
 if [ -f $CHARM_DIR/files/hostgroups_nagios2.cfg ]; then
     # Write the new hostgroups_nagios2.cfg file to prevent servers being classified as Debian.
     cp -v $CHARM_DIR/files/hostgroups_nagios2.cfg /etc/nagios3/conf.d/hostgroups_nagios2.cfg
diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
index 1016391..19c8e80 100755
--- a/hooks/upgrade-charm
+++ b/hooks/upgrade-charm
@@ -374,6 +374,6 @@ update_password('nagiosro', ro_password)
 if password:
     update_password('nagiosadmin', password)
 
-
+subprocess.call(['scripts/postfix_loopback_only.sh'])
 subprocess.call(['hooks/mymonitors-relation-joined'])
 subprocess.call(['hooks/monitors-relation-changed'])
diff --git a/scripts/postfix_loopback_only.sh b/scripts/postfix_loopback_only.sh
new file mode 100755
index 0000000..77c388c
--- /dev/null
+++ b/scripts/postfix_loopback_only.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+POSTFIX_CONF="/etc/postfix/main.cf"
+if grep -qE '^inet_interfaces.*all' $POSTFIX_CONF; then
+    sed -i 's/^inet_interfaces.*/inet_interfaces = loopback-only/' $POSTFIX_CONF
+    systemctl restart postfix
+fi

Follow ups