From 434f51aae4063109c095536bea92b45450339d4a Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Mon, 9 Dec 2019 18:49:21 +0100 Subject: [PATCH] Logic to auto-detect agent_major_version --- manifests/init.pp | 25 +++++++++++++++------ manifests/integration.pp | 2 +- manifests/integrations/activemq_xml.pp | 2 +- manifests/integrations/apache.pp | 2 +- manifests/integrations/cacti.pp | 2 +- manifests/integrations/cassandra.pp | 2 +- manifests/integrations/ceph.pp | 2 +- manifests/integrations/consul.pp | 2 +- manifests/integrations/directory.pp | 2 +- manifests/integrations/disk.pp | 2 +- manifests/integrations/dns_check.pp | 2 +- manifests/integrations/docker_daemon.pp | 4 ++-- manifests/integrations/elasticsearch.pp | 2 +- manifests/integrations/fluentd.pp | 2 +- manifests/integrations/generic.pp | 2 +- manifests/integrations/haproxy.pp | 2 +- manifests/integrations/http_check.pp | 2 +- manifests/integrations/jenkins.pp | 2 +- manifests/integrations/jmx.pp | 2 +- manifests/integrations/kafka.pp | 2 +- manifests/integrations/kong.pp | 2 +- manifests/integrations/kubernetes.pp | 2 +- manifests/integrations/kubernetes_state.pp | 2 +- manifests/integrations/linux_proc_extras.pp | 2 +- manifests/integrations/logs.pp | 2 +- manifests/integrations/marathon.pp | 2 +- manifests/integrations/memcache.pp | 2 +- manifests/integrations/mesos_master.pp | 4 ++-- manifests/integrations/mesos_slave.pp | 2 +- manifests/integrations/mongo.pp | 2 +- manifests/integrations/mysql.pp | 2 +- manifests/integrations/network.pp | 2 +- manifests/integrations/nginx.pp | 2 +- manifests/integrations/ntp.pp | 2 +- manifests/integrations/pgbouncer.pp | 2 +- manifests/integrations/php_fpm.pp | 2 +- manifests/integrations/postfix.pp | 2 +- manifests/integrations/postgres.pp | 2 +- manifests/integrations/process.pp | 2 +- manifests/integrations/rabbitmq.pp | 2 +- manifests/integrations/redis.pp | 2 +- manifests/integrations/riak.pp | 2 +- manifests/integrations/snmp.pp | 2 +- manifests/integrations/solr.pp | 2 +- manifests/integrations/ssh.pp | 2 +- manifests/integrations/supervisord.pp | 2 +- manifests/integrations/system_core.pp | 2 +- manifests/integrations/tcp_check.pp | 2 +- manifests/integrations/tomcat.pp | 2 +- manifests/integrations/twemproxy.pp | 2 +- manifests/integrations/varnish.pp | 2 +- manifests/integrations/zk.pp | 2 +- manifests/params.pp | 2 +- manifests/redhat.pp | 2 +- manifests/ubuntu.pp | 2 +- manifests/windows.pp | 2 +- 56 files changed, 75 insertions(+), 64 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 46a746f7..cb0651b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -285,7 +285,7 @@ Boolean $sd_jmx_enable = false, String $consul_token = '', Integer $cmd_port = 5001, - Integer $agent_major_version = $datadog_agent::params::agent_major_version, + Optional[Integer] $agent_major_version = undef, Optional[String] $conf_dir = undef, Boolean $conf_dir_purge = $datadog_agent::params::conf_dir_purge, $dd_user = $datadog_agent::params::dd_user, @@ -313,7 +313,18 @@ Optional[String] $agent_version = $datadog_agent::params::agent_version, ) inherits datadog_agent::params { - if $agent_major_version != 5 and $agent_major_version != 6 and $agent_major_version != 7 { + if $agent_version != 'latest' and $agent_version =~ /([0-9]+:)?([0-9]+)\.([0-9]+)\.([0-9]+)([^-\s]+)?(?:-([0-9]+))?/ { + $_agent_major_version = 0 + $2 # Cast to integer + if $agent_major_version != undef and $agent_major_version != $_agent_major_version { + fail('Provided and deduced agent_major_version don\'t match') + } + } elsif $agent_major_version != undef { + $_agent_major_version = $agent_major_version + } else { + $_agent_major_version = $datadog_agent::params::default_agent_major_version + } + + if $_agent_major_version != 5 and $_agent_major_version != 6 and $_agent_major_version != 7 { fail('agent_major_version must be either 5, 6 or 7') } @@ -335,7 +346,7 @@ validate_legacy(String, 'validate_re', $_syslog_port, '^\d*$') if $conf_dir == undef { - if $agent_major_version == 5 { + if $_agent_major_version == 5 { $_conf_dir = $datadog_agent::params::legacy_conf_dir } else { $_conf_dir = $datadog_agent::params::conf_dir @@ -377,7 +388,7 @@ case $::operatingsystem { 'Ubuntu','Debian' : { class { 'datadog_agent::ubuntu': - agent_major_version => $agent_major_version, + agent_major_version => $_agent_major_version, agent_version => $agent_version, service_ensure => $service_ensure, service_enable => $service_enable, @@ -390,7 +401,7 @@ } 'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux' : { class { 'datadog_agent::redhat': - agent_major_version => $agent_major_version, + agent_major_version => $_agent_major_version, agent_repo_uri => $agent_repo_uri, manage_repo => $manage_repo, agent_version => $agent_version, @@ -401,7 +412,7 @@ } 'Windows' : { class { 'datadog_agent::windows' : - agent_major_version => $agent_major_version, + agent_major_version => $_agent_major_version, agent_repo_uri => $agent_repo_uri, agent_version => $agent_version, service_ensure => $service_ensure, @@ -438,7 +449,7 @@ } } - if $agent_major_version == 5 { + if $_agent_major_version == 5 { if ($::operatingsystem == 'Windows') { fail('Installation of agent 5 with puppet is not supported on Windows') diff --git a/manifests/integration.pp b/manifests/integration.pp index 430e9333..932ab806 100644 --- a/manifests/integration.pp +++ b/manifests/integration.pp @@ -7,7 +7,7 @@ include datadog_agent - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst = "${datadog_agent::params::conf_dir}/${integration}.d/conf.yaml" file { "${datadog_agent::params::conf_dir}/${integration}.d": ensure => directory, diff --git a/manifests/integrations/activemq_xml.pp b/manifests/integrations/activemq_xml.pp index aa3ad009..4a46b8bf 100644 --- a/manifests/integrations/activemq_xml.pp +++ b/manifests/integrations/activemq_xml.pp @@ -55,7 +55,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/activemq_xml.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/activemq_xml.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/apache.pp b/manifests/integrations/apache.pp index 523ab073..247d57a0 100644 --- a/manifests/integrations/apache.pp +++ b/manifests/integrations/apache.pp @@ -36,7 +36,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/apache.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/apache.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/cacti.pp b/manifests/integrations/cacti.pp index 767388b6..d46f172c 100644 --- a/manifests/integrations/cacti.pp +++ b/manifests/integrations/cacti.pp @@ -21,7 +21,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/cacti.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/cacti.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/cassandra.pp b/manifests/integrations/cassandra.pp index 61a43531..b82c5fd0 100644 --- a/manifests/integrations/cassandra.pp +++ b/manifests/integrations/cassandra.pp @@ -35,7 +35,7 @@ require ::datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/cassandra.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/cassandra.d" file { $legacy_dst: diff --git a/manifests/integrations/ceph.pp b/manifests/integrations/ceph.pp index 77cbb6da..80d19e63 100644 --- a/manifests/integrations/ceph.pp +++ b/manifests/integrations/ceph.pp @@ -24,7 +24,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ceph.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ceph.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/consul.pp b/manifests/integrations/consul.pp index 09ece2f7..1c5d38c0 100644 --- a/manifests/integrations/consul.pp +++ b/manifests/integrations/consul.pp @@ -36,7 +36,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/consul.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/consul.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/directory.pp b/manifests/integrations/directory.pp index 8d577156..c6338f3d 100644 --- a/manifests/integrations/directory.pp +++ b/manifests/integrations/directory.pp @@ -89,7 +89,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/directory.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/directory.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/disk.pp b/manifests/integrations/disk.pp index 8ad7d3fd..16315527 100644 --- a/manifests/integrations/disk.pp +++ b/manifests/integrations/disk.pp @@ -70,7 +70,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/disk.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/disk.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/dns_check.pp b/manifests/integrations/dns_check.pp index 08b531b9..fbe43848 100644 --- a/manifests/integrations/dns_check.pp +++ b/manifests/integrations/dns_check.pp @@ -36,7 +36,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/dns_check.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/dns_check.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/docker_daemon.pp b/manifests/integrations/docker_daemon.pp index 60516579..30ef4683 100644 --- a/manifests/integrations/docker_daemon.pp +++ b/manifests/integrations/docker_daemon.pp @@ -64,7 +64,7 @@ notify => Service[$datadog_agent::params::service_name] } - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $legacy_dir = "${datadog_agent::params::conf_dir}/docker_daemon.d" file { $legacy_dir: @@ -84,7 +84,7 @@ ensure => 'absent' } - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/docker.d" file { $dst_dir: diff --git a/manifests/integrations/elasticsearch.pp b/manifests/integrations/elasticsearch.pp index 413d8a4b..0101ce29 100644 --- a/manifests/integrations/elasticsearch.pp +++ b/manifests/integrations/elasticsearch.pp @@ -64,7 +64,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/elastic.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/elastic.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/fluentd.pp b/manifests/integrations/fluentd.pp index baab738b..89e683d9 100644 --- a/manifests/integrations/fluentd.pp +++ b/manifests/integrations/fluentd.pp @@ -24,7 +24,7 @@ include ::datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/fluentd.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/fluentd.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/generic.pp b/manifests/integrations/generic.pp index 6f23c63b..3835b8d7 100644 --- a/manifests/integrations/generic.pp +++ b/manifests/integrations/generic.pp @@ -23,7 +23,7 @@ ) inherits datadog_agent::params { $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/${integration_name}.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/${integration_name}.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/haproxy.pp b/manifests/integrations/haproxy.pp index 460fc7a6..fa1d6bfe 100644 --- a/manifests/integrations/haproxy.pp +++ b/manifests/integrations/haproxy.pp @@ -37,7 +37,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/haproxy.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/haproxy.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index b781927e..73189608 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -230,7 +230,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/http_check.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/http_check.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/jenkins.pp b/manifests/integrations/jenkins.pp index 84f55eca..708aaf59 100644 --- a/manifests/integrations/jenkins.pp +++ b/manifests/integrations/jenkins.pp @@ -19,7 +19,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/jenkins.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/jenkins.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/jmx.pp b/manifests/integrations/jmx.pp index 0a27c892..e2246c1e 100644 --- a/manifests/integrations/jmx.pp +++ b/manifests/integrations/jmx.pp @@ -68,7 +68,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/jmx.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/jmx.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/kafka.pp b/manifests/integrations/kafka.pp index 25d8ce5e..fae25ca7 100644 --- a/manifests/integrations/kafka.pp +++ b/manifests/integrations/kafka.pp @@ -87,7 +87,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kafka.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kafka.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/kong.pp b/manifests/integrations/kong.pp index 42c306d4..b90f244b 100644 --- a/manifests/integrations/kong.pp +++ b/manifests/integrations/kong.pp @@ -35,7 +35,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kong.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kong.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/kubernetes.pp b/manifests/integrations/kubernetes.pp index 7071c1e4..e43d871b 100644 --- a/manifests/integrations/kubernetes.pp +++ b/manifests/integrations/kubernetes.pp @@ -33,7 +33,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kubernetes.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kubernetes.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/kubernetes_state.pp b/manifests/integrations/kubernetes_state.pp index fac5a006..bdf1da11 100644 --- a/manifests/integrations/kubernetes_state.pp +++ b/manifests/integrations/kubernetes_state.pp @@ -25,7 +25,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kubernetes_state.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kubernetes_state.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/linux_proc_extras.pp b/manifests/integrations/linux_proc_extras.pp index e9e627a4..9531bea6 100644 --- a/manifests/integrations/linux_proc_extras.pp +++ b/manifests/integrations/linux_proc_extras.pp @@ -19,7 +19,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/linux_proc_extras.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/linux_proc_extras.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/logs.pp b/manifests/integrations/logs.pp index 79e2ac85..7e36b53a 100644 --- a/manifests/integrations/logs.pp +++ b/manifests/integrations/logs.pp @@ -39,7 +39,7 @@ class datadog_agent::integrations::logs( Array $logs = [], ) inherits datadog_agent::params { - unless $::datadog_agent::agent_major_version == 5 { + unless $::datadog_agent::_agent_major_version == 5 { include datadog_agent file { "${datadog_agent::params::conf_dir}/logs.yaml": diff --git a/manifests/integrations/marathon.pp b/manifests/integrations/marathon.pp index e221fc53..dc79a1be 100644 --- a/manifests/integrations/marathon.pp +++ b/manifests/integrations/marathon.pp @@ -19,7 +19,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/marathon.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/marathon.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/memcache.pp b/manifests/integrations/memcache.pp index 2798b782..6610a4bd 100644 --- a/manifests/integrations/memcache.pp +++ b/manifests/integrations/memcache.pp @@ -55,7 +55,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mcache.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mcache.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/mesos_master.pp b/manifests/integrations/mesos_master.pp index 4b5f7c9e..f86572ee 100644 --- a/manifests/integrations/mesos_master.pp +++ b/manifests/integrations/mesos_master.pp @@ -18,7 +18,7 @@ ) inherits datadog_agent::params { include datadog_agent - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mesos.d" file { $dst_dir: @@ -39,7 +39,7 @@ } $legacy_dst_master = "${datadog_agent::params::legacy_conf_dir}/mesos_master.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_master_dir = "${datadog_agent::params::conf_dir}/mesos_master.d" file { $legacy_dst_master: ensure => 'absent' diff --git a/manifests/integrations/mesos_slave.pp b/manifests/integrations/mesos_slave.pp index 141ce7be..6e936289 100644 --- a/manifests/integrations/mesos_slave.pp +++ b/manifests/integrations/mesos_slave.pp @@ -18,7 +18,7 @@ ) inherits datadog_agent::params { $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mesos_slave.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mesos_slave.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/mongo.pp b/manifests/integrations/mongo.pp index e2223d7e..d6829643 100644 --- a/manifests/integrations/mongo.pp +++ b/manifests/integrations/mongo.pp @@ -62,7 +62,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mongo.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mongo.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/mysql.pp b/manifests/integrations/mysql.pp index 9ff8610e..ed2dee0b 100644 --- a/manifests/integrations/mysql.pp +++ b/manifests/integrations/mysql.pp @@ -112,7 +112,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mysql.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mysql.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/network.pp b/manifests/integrations/network.pp index 500cefd8..0ef6389d 100644 --- a/manifests/integrations/network.pp +++ b/manifests/integrations/network.pp @@ -30,7 +30,7 @@ include ::datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/network.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/network.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/nginx.pp b/manifests/integrations/nginx.pp index afabff79..f40b895f 100644 --- a/manifests/integrations/nginx.pp +++ b/manifests/integrations/nginx.pp @@ -64,7 +64,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/nginx.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/nginx.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/ntp.pp b/manifests/integrations/ntp.pp index ae279fe6..2d65d25a 100644 --- a/manifests/integrations/ntp.pp +++ b/manifests/integrations/ntp.pp @@ -33,7 +33,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ntp.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ntp.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/pgbouncer.pp b/manifests/integrations/pgbouncer.pp index 2baba44b..b1d595f1 100644 --- a/manifests/integrations/pgbouncer.pp +++ b/manifests/integrations/pgbouncer.pp @@ -54,7 +54,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/pgbouncer.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/pgbouncer.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/php_fpm.pp b/manifests/integrations/php_fpm.pp index bbc4876a..1bcf8ab8 100644 --- a/manifests/integrations/php_fpm.pp +++ b/manifests/integrations/php_fpm.pp @@ -46,7 +46,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/php_fpm.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/php_fpm.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/postfix.pp b/manifests/integrations/postfix.pp index 3f5064d5..fe799cd4 100644 --- a/manifests/integrations/postfix.pp +++ b/manifests/integrations/postfix.pp @@ -49,7 +49,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/postfix.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/postfix.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/postgres.pp b/manifests/integrations/postgres.pp index 003c918a..9d98dcc2 100644 --- a/manifests/integrations/postgres.pp +++ b/manifests/integrations/postgres.pp @@ -103,7 +103,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/postgres.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/postgres.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/process.pp b/manifests/integrations/process.pp index 83762816..66ee1ee8 100644 --- a/manifests/integrations/process.pp +++ b/manifests/integrations/process.pp @@ -53,7 +53,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/process.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/process.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/rabbitmq.pp b/manifests/integrations/rabbitmq.pp index f4801fe4..36b82dff 100644 --- a/manifests/integrations/rabbitmq.pp +++ b/manifests/integrations/rabbitmq.pp @@ -68,7 +68,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/rabbitmq.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/rabbitmq.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/redis.pp b/manifests/integrations/redis.pp index a9fded87..9d5db2b9 100644 --- a/manifests/integrations/redis.pp +++ b/manifests/integrations/redis.pp @@ -75,7 +75,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/redisdb.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/redisdb.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/riak.pp b/manifests/integrations/riak.pp index c3b37d0a..78437b3b 100644 --- a/manifests/integrations/riak.pp +++ b/manifests/integrations/riak.pp @@ -25,7 +25,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/riak.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/riak.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/snmp.pp b/manifests/integrations/snmp.pp index 80a83695..b5579edf 100755 --- a/manifests/integrations/snmp.pp +++ b/manifests/integrations/snmp.pp @@ -70,7 +70,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/snmp.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/snmp.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/solr.pp b/manifests/integrations/solr.pp index 1132315d..b5ea60ba 100644 --- a/manifests/integrations/solr.pp +++ b/manifests/integrations/solr.pp @@ -39,7 +39,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/solr.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/solr.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/ssh.pp b/manifests/integrations/ssh.pp index c121ee50..ada1d9e3 100644 --- a/manifests/integrations/ssh.pp +++ b/manifests/integrations/ssh.pp @@ -38,7 +38,7 @@ include ::datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ssh.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ssh_check.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/supervisord.pp b/manifests/integrations/supervisord.pp index d4b32a4e..3019ef1b 100644 --- a/manifests/integrations/supervisord.pp +++ b/manifests/integrations/supervisord.pp @@ -47,7 +47,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/supervisord.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/supervisord.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/system_core.pp b/manifests/integrations/system_core.pp index 12977542..8125ef45 100644 --- a/manifests/integrations/system_core.pp +++ b/manifests/integrations/system_core.pp @@ -10,7 +10,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/system_core.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/system_core.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/tcp_check.pp b/manifests/integrations/tcp_check.pp index 87a626e1..8b04451c 100644 --- a/manifests/integrations/tcp_check.pp +++ b/manifests/integrations/tcp_check.pp @@ -118,7 +118,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/tcp_check.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/tcp_check.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/tomcat.pp b/manifests/integrations/tomcat.pp index 32e06a1f..9ab5baa6 100644 --- a/manifests/integrations/tomcat.pp +++ b/manifests/integrations/tomcat.pp @@ -43,7 +43,7 @@ $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/tomcat.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/tomcat.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/twemproxy.pp b/manifests/integrations/twemproxy.pp index ac0f4763..38c42005 100644 --- a/manifests/integrations/twemproxy.pp +++ b/manifests/integrations/twemproxy.pp @@ -42,7 +42,7 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/twemproxy.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/twemproxy.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/varnish.pp b/manifests/integrations/varnish.pp index 9a807ee7..3a348a0b 100644 --- a/manifests/integrations/varnish.pp +++ b/manifests/integrations/varnish.pp @@ -29,7 +29,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/varnish.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/varnish.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/integrations/zk.pp b/manifests/integrations/zk.pp index 596c589f..0ef8df0d 100644 --- a/manifests/integrations/zk.pp +++ b/manifests/integrations/zk.pp @@ -33,7 +33,7 @@ include datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/zk.yaml" - if $::datadog_agent::agent_major_version > 5 { + if $::datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/zk.d" file { $legacy_dst: ensure => 'absent' diff --git a/manifests/params.pp b/manifests/params.pp index b4305262..0706c355 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,7 +6,7 @@ class datadog_agent::params { $datadog_site = 'datadoghq.com' $dd_groups = undef - $agent_major_version = 7 + $default_agent_major_version = 7 $agent_version = 'latest' $dogapi_version = 'installed' $gem_provider = 'puppetserver_gem' diff --git a/manifests/redhat.pp b/manifests/redhat.pp index 9eb6684d..5f9cec77 100644 --- a/manifests/redhat.pp +++ b/manifests/redhat.pp @@ -4,7 +4,7 @@ # class datadog_agent::redhat( - Integer $agent_major_version = $datadog_agent::params::agent_major_version, + Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, Optional[String] $agent_repo_uri = undef, Boolean $manage_repo = true, String $agent_version = $datadog_agent::params::agent_version, diff --git a/manifests/ubuntu.pp b/manifests/ubuntu.pp index c5d7f35f..596880e6 100644 --- a/manifests/ubuntu.pp +++ b/manifests/ubuntu.pp @@ -4,7 +4,7 @@ # class datadog_agent::ubuntu( - Integer $agent_major_version = $datadog_agent::params::agent_major_version, + Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, String $apt_key = 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE', String $agent_version = $datadog_agent::params::agent_version, Optional[String] $agent_repo_uri = undef, diff --git a/manifests/windows.pp b/manifests/windows.pp index 07e5c317..789d1706 100644 --- a/manifests/windows.pp +++ b/manifests/windows.pp @@ -4,7 +4,7 @@ # class datadog_agent::windows( - Integer $agent_major_version = $datadog_agent::params::agent_major_version, + Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, String $agent_version = $datadog_agent::params::agent_version, String $service_ensure = 'running', Optional[String] $agent_repo_uri = undef,