Skip to content

Commit

Permalink
Restart the datadog-agent service after an integration install (#59)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KSerrania authored Aug 28, 2020
1 parent 2936471 commit cc63647
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion datadog/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ datadog_{{ check_name }}_yaml_installed:
{% set install_command = "install" %}
{%- endif %}
datadog_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed:
datadog_check_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed:
cmd.run:
- name: sudo -u dd-agent datadog-agent integration {{ install_command }} datadog-{{ check_name }}=={{ datadog_checks[check_name].version }}
- unless: sudo -u dd-agent datadog-agent integration freeze | grep datadog-{{ check_name }}=={{ datadog_checks[check_name].version }}
{%- endif %}
{%- endif %}
Expand Down
11 changes: 10 additions & 1 deletion datadog/service.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "datadog/map.jinja" import datadog_install_settings, datadog_checks with context %}
{% from "datadog/map.jinja" import datadog_install_settings, datadog_checks, latest_agent_version, parsed_version with context %}
{% set config_file_path = '%s/%s'|format(datadog_install_settings.config_folder, datadog_install_settings.config_file) -%}
datadog-agent-service:
Expand All @@ -11,3 +11,12 @@ datadog-agent-service:
{%- if datadog_checks | length %}
- file: {{ datadog_install_settings.confd_path }}/*
{% endif %}
{%- if latest_agent_version or parsed_version[1] != '5' %}
{%- if datadog_checks is defined %}
{%- for check_name in datadog_checks %}
{%- if datadog_checks[check_name].version is defined %}
- cmd: datadog_check_{{ check_name }}_version_{{ datadog_checks[check_name].version }}_installed
{% endif %}
{% endfor %}
{% endif %}
{% endif %}

0 comments on commit cc63647

Please sign in to comment.