Skip to content

Commit 5146dc4

Browse files
authored
Merge pull request #375 from DataDog/jaime/tworundowngrade
[agent6] fix beta downgrade on `latest`
2 parents e02286d + dbe0cc2 commit 5146dc4

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

lib/facter/beta_repo.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Facter.add('apt_agent6_beta_repo') do
2+
setcode do
3+
File.exist? '/etc/apt/sources.list.d/datadog-beta.list'
4+
end
5+
end

manifests/ubuntu.pp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,37 @@
3232
}
3333
}
3434

35-
file { '/etc/apt/sources.list.d/datadog-beta.list':
36-
ensure => absent,
35+
# This is a hack - I'm not happy about it, but we should rarely
36+
# hit this code path
37+
#
38+
# Also, using $::apt_agent6_beta_repo to access fact instead of
39+
# $facts hash - for compatibility with puppet3.x default behavior
40+
if $::apt_agent6_beta_repo and $agent_version == 'latest' {
41+
exec { 'datadog_apt-get_remove_agent6':
42+
command => '/usr/bin/apt-get remove -y -q datadog-agent',
43+
}
44+
} else {
45+
exec { 'datadog_apt-get_remove_agent6':
46+
command => ':', # NOOP builtin
47+
noop => true,
48+
refreshonly => true,
49+
provider => 'shell',
50+
}
51+
}
52+
53+
if $::apt_agent6_beta_repo {
54+
file { '/etc/apt/sources.list.d/datadog-beta.list':
55+
ensure => absent,
56+
}
3757
}
3858

3959
file { '/etc/apt/sources.list.d/datadog.list':
60+
ensure => file,
4061
owner => 'root',
4162
group => 'root',
4263
content => template('datadog_agent/datadog.list.erb'),
43-
notify => Exec['datadog_apt-get_update'],
64+
notify => [Exec['datadog_apt-get_remove_agent6'],
65+
Exec['datadog_apt-get_update']],
4466
require => Package['apt-transport-https'],
4567
}
4668

@@ -49,7 +71,7 @@
4971
refreshonly => true,
5072
tries => 2, # https://bugs.launchpad.net/launchpad/+bug/1430011 won't get fixed until 16.04 xenial
5173
try_sleep => 30,
52-
require => File['/etc/apt/sources.list.d/datadog-beta.list'],
74+
require => File['/etc/apt/sources.list.d/datadog.list'],
5375
}
5476

5577
package { 'datadog-agent-base':
@@ -70,5 +92,4 @@
7092
pattern => 'dd-agent',
7193
require => Package['datadog-agent'],
7294
}
73-
7495
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datadog-datadog_agent",
3-
"version": "1.12.0-alpha",
3+
"version": "1.12.0",
44
"author": "James Turnbull (<james@lovedthanlost.net>) and Rob Terhaar (<rob@atlanticdynamic>) for Datadog Inc.",
55
"summary": "Install the Datadog monitoring agent and report Puppet runs to Datadog",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)