Skip to content

Commit 6736f42

Browse files
authored
[BUGFIX] Handle windows Agent pinned version above 7.46 (#860)
* handle windows package version after 7.47 * remove useless is_integer, conversion would have errored out if not
1 parent 29b68f0 commit 6736f42

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

manifests/windows.pp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,21 @@
6565
if $agent_version == 'latest' {
6666
$ensure_version = 'installed'
6767
} else {
68-
# While artifacts contain X.Y.Z in their name, their installed Windows versions are actually X.Y.Z.1
69-
$ensure_version = "${agent_version}.1"
68+
# While artifacts contain X.Y.Z in their name, their installed Windows versions are actually X.Y.Z.1 before 7.47.0.
69+
# After 7.47.0, the version is X.Y.Z.0.
70+
# Ref: https://github.com/DataDog/datadog-agent/pull/19576
71+
$version_parts = split($agent_version, '[.]') # . is a meta regex character, so we need to escape it with [].
72+
if length($version_parts) < 2 {
73+
fail("Invalid version format: ${agent_version}. Expected format: X.Y.Z")
74+
}
75+
76+
$minor_version = Integer($version_parts[1])
77+
78+
if $minor_version <= 46 {
79+
$ensure_version = "${agent_version}.1"
80+
} else {
81+
$ensure_version = "${agent_version}.0"
82+
}
7083
}
7184

7285
$hostname_option = $hostname ? { '' => {}, default => { 'HOSTNAME' => $hostname } }

0 commit comments

Comments
 (0)