From 1c4b6399440d3bd08b9756b7755cf86e05681251 Mon Sep 17 00:00:00 2001 From: Michael Chmielewski Date: Thu, 29 Apr 2021 12:54:08 -0400 Subject: [PATCH 1/2] Fix an issue where if the formula was not confuring the agent, it would fail to run because we still tried to start the agent service * In this case, we just set upthe service as enabled. * Also removed an errant setting in a test --- .kitchen.yml | 1 - threatstack/init.sls | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 72b25b3..766635f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -69,7 +69,6 @@ platforms: - yum install -y audit initscripts - sed -i 's/local_events = yes/local_events = no/g' /etc/audit/auditd.conf - systemctl enable auditd.service - image: centos:7 - name: centos-7 image: centos:7 driver_config: diff --git a/threatstack/init.sls b/threatstack/init.sls index e1b5bb7..29ed6e6 100644 --- a/threatstack/init.sls +++ b/threatstack/init.sls @@ -139,11 +139,19 @@ tsagent-config: # NOTE: We do not signal the cloudsight service to restart via the package # resource because the workflow differs between fresh installation and # upgrades. The package scripts will handle this. +# +# We only enable the service if `ts_configure_agent` is True, because if +# the agent isn't configured, starting up the agent will fail +{% if pillar['ts_configure_agent'] is not defined or pillar['ts_configure_agent'] == True %} threatstack: service.running: - enable: True - - restart: True -{% if pillar['ts_agent_config_args'] is defined %} + # - restart: True + {% if pillar['ts_agent_config_args'] is defined %} - watch: - cmd: tsagent-config + {% endif %} +{% else %} +threatstack: + service.enabled {% endif %} From 404bba1d1316b8b72ff0a4bc3d1c29492c4c2497 Mon Sep 17 00:00:00 2001 From: Michael Chmielewski Date: Thu, 29 Apr 2021 13:44:49 -0400 Subject: [PATCH 2/2] Uncommenrt out something I had disabled for testing. --- threatstack/init.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threatstack/init.sls b/threatstack/init.sls index 29ed6e6..6838666 100644 --- a/threatstack/init.sls +++ b/threatstack/init.sls @@ -146,7 +146,7 @@ tsagent-config: threatstack: service.running: - enable: True - # - restart: True + - restart: True {% if pillar['ts_agent_config_args'] is defined %} - watch: - cmd: tsagent-config