From 3c3edf633bc0a62a16ea99d1a1f401afba18c154 Mon Sep 17 00:00:00 2001
From: Stephen C Phillips <steve@scphillips.com>
Date: Mon, 18 Jun 2018 16:42:54 +0100
Subject: [PATCH] Pauses telegraf while updating config

This should avoid a database called $DATABASE_NAME appearing in influx
---
 scripts/test/fixture.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/test/fixture.sh b/scripts/test/fixture.sh
index fc94e8e..907d675 100755
--- a/scripts/test/fixture.sh
+++ b/scripts/test/fixture.sh
@@ -69,6 +69,9 @@ create() {
             cmd=/vagrant/scripts/clmc-agent/install.sh
             lxc-attach -n ${service_name} -v REPO_ROOT="/vagrant" -- ${cmd}
 
+            # stop telegraf before changing the configs
+            lxc-attach -n ${service_name} -- service telegraf stop
+
             # copy telegraf configuration templates
             cp -f ${repo_root}/scripts/clmc-agent/telegraf.conf ${container_dir}/etc/telegraf/
             cp -f ${repo_root}/scripts/clmc-agent/telegraf_output.conf ${container_dir}/etc/telegraf/telegraf.d/
@@ -81,8 +84,8 @@ create() {
             cmd="/vagrant/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_id_instance} ${sf_id} ${sf_id_instance} ${ipendpoint_id} ${sr_id} ${influxdb_url} ${database_name}"
             lxc-attach -n ${service_name} -- ${cmd}
 
-            # restart telegraf
-            lxc-attach -n ${service_name} -- service telegraf restart
+            # start telegraf
+            lxc-attach -n ${service_name} -- service telegraf start
         fi
 
         # set forward ports
-- 
GitLab