Skip to content

Commit cc63647

Browse files
authored
Restart the datadog-agent service after an integration install (#59)
Only try to install integration if the targeted version is not already installed (to make the formula idempotent). Watch integration installs: restart the datadog-agent service when at least one integration install happens.
1 parent 2936471 commit cc63647

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

datadog/config.sls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ datadog_{{ check_name }}_yaml_installed:
6767
{% set install_command = "install" %}
6868
{%- endif %}
6969
70-
datadog_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed:
70+
datadog_check_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed:
7171
cmd.run:
7272
- name: sudo -u dd-agent datadog-agent integration {{ install_command }} datadog-{{ check_name }}=={{ datadog_checks[check_name].version }}
73+
- unless: sudo -u dd-agent datadog-agent integration freeze | grep datadog-{{ check_name }}=={{ datadog_checks[check_name].version }}
7374
{%- endif %}
7475
{%- endif %}
7576

datadog/service.sls

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% from "datadog/map.jinja" import datadog_install_settings, datadog_checks with context %}
1+
{% from "datadog/map.jinja" import datadog_install_settings, datadog_checks, latest_agent_version, parsed_version with context %}
22
{% set config_file_path = '%s/%s'|format(datadog_install_settings.config_folder, datadog_install_settings.config_file) -%}
33
44
datadog-agent-service:
@@ -11,3 +11,12 @@ datadog-agent-service:
1111
{%- if datadog_checks | length %}
1212
- file: {{ datadog_install_settings.confd_path }}/*
1313
{% endif %}
14+
{%- if latest_agent_version or parsed_version[1] != '5' %}
15+
{%- if datadog_checks is defined %}
16+
{%- for check_name in datadog_checks %}
17+
{%- if datadog_checks[check_name].version is defined %}
18+
- cmd: datadog_check_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed
19+
{% endif %}
20+
{% endfor %}
21+
{% endif %}
22+
{% endif %}

0 commit comments

Comments
 (0)