Skip to content

Commit b2061f9

Browse files
authored
Only declare the Agent package if not already declared (DataDog#672)
We need the Agent package to be declared even when we don't install it, since there's code that depends on it. Our current approach is to always declare it, which works if the package is installed by something other than Puppet (eg: chocolatey), since our declaration would not try to install it again and the code that depends on that declaration would still be happy. However, in case the package is being installed by a different Puppet module, it would fail with a Duplicate declaration error.
1 parent f9fb91f commit b2061f9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

manifests/init.pp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,11 @@
449449
default: { fail("Class[datadog_agent]: Unsupported operatingsystem: ${::operatingsystem}") }
450450
}
451451
} else {
452-
package { $datadog_agent::params::package_name:
453-
ensure => present,
454-
source => 'Agent installation not managed by Puppet, make sure the Agent is installed beforehand.',
452+
if ! defined(Package[$datadog_agent::params::package_name]) {
453+
package { $datadog_agent::params::package_name:
454+
ensure => present,
455+
source => 'Agent installation not managed by Puppet, make sure the Agent is installed beforehand.',
456+
}
455457
}
456458
}
457459

0 commit comments

Comments
 (0)