Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[agent6] fix beta downgrade on latest #375

Merged
merged 4 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/facter/beta_repo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Facter.add('apt_agent6_beta_repo') do
setcode do
File.exist? '/etc/apt/sources.list.d/datadog-beta.list'
end
end
31 changes: 26 additions & 5 deletions manifests/ubuntu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,37 @@
}
}

file { '/etc/apt/sources.list.d/datadog-beta.list':
ensure => absent,
# This is a hack - I'm not happy about it, but we should rarely
# hit this code path
#
# Also, using $::apt_agent6_beta_repo to access fact instead of
# $facts hash - for compatibility with puppet3.x default behavior
if $::apt_agent6_beta_repo and $agent_version == 'latest' {
exec { 'datadog_apt-get_remove_agent6':
command => '/usr/bin/apt-get remove -y -q datadog-agent',
}
} else {
exec { 'datadog_apt-get_remove_agent6':
command => ':', # NOOP builtin
noop => true,
refreshonly => true,
provider => 'shell',
}
}

if $::apt_agent6_beta_repo {
file { '/etc/apt/sources.list.d/datadog-beta.list':
ensure => absent,
}
}

file { '/etc/apt/sources.list.d/datadog.list':
ensure => file,
owner => 'root',
group => 'root',
content => template('datadog_agent/datadog.list.erb'),
notify => Exec['datadog_apt-get_update'],
notify => [Exec['datadog_apt-get_remove_agent6'],
Exec['datadog_apt-get_update']],
require => Package['apt-transport-https'],
}

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

package { 'datadog-agent-base':
Expand All @@ -70,5 +92,4 @@
pattern => 'dd-agent',
require => Package['datadog-agent'],
}

}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datadog-datadog_agent",
"version": "1.12.0-alpha",
"version": "1.12.0",
"author": "James Turnbull (<[email protected]>) and Rob Terhaar (<rob@atlanticdynamic>) for Datadog Inc.",
"summary": "Install the Datadog monitoring agent and report Puppet runs to Datadog",
"license": "Apache-2.0",
Expand Down