Skip to content

Commit dbe0cc2

Browse files
committed
[facts] use old-school fact naming convention for compatibility + lint
1 parent 08656aa commit dbe0cc2

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

lib/facter/beta_repo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Facter.add('agent6_beta_repo') do
1+
Facter.add('apt_agent6_beta_repo') do
22
setcode do
33
File.exist? '/etc/apt/sources.list.d/datadog-beta.list'
44
end

manifests/ubuntu.pp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
}
3434

3535
# This is a hack - I'm not happy about it, but we should rarely
36-
# hit this code path.
37-
if $facts['agent6_beta_repo'] and $agent_version == 'latest' {
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' {
3841
exec { 'datadog_apt-get_remove_agent6':
3942
command => '/usr/bin/apt-get remove -y -q datadog-agent',
4043
}
@@ -47,22 +50,22 @@
4750
}
4851
}
4952

50-
if $facts['agent6_beta_repo'] {
53+
if $::apt_agent6_beta_repo {
5154
file { '/etc/apt/sources.list.d/datadog-beta.list':
5255
ensure => absent,
5356
}
5457
}
5558

5659
file { '/etc/apt/sources.list.d/datadog.list':
60+
ensure => file,
5761
owner => 'root',
5862
group => 'root',
59-
ensure => file,
6063
content => template('datadog_agent/datadog.list.erb'),
6164
notify => [Exec['datadog_apt-get_remove_agent6'],
6265
Exec['datadog_apt-get_update']],
6366
require => Package['apt-transport-https'],
6467
}
65-
68+
6669
exec { 'datadog_apt-get_update':
6770
command => '/usr/bin/apt-get update',
6871
refreshonly => true,
@@ -71,18 +74,17 @@
7174
require => File['/etc/apt/sources.list.d/datadog.list'],
7275
}
7376

74-
7577
package { 'datadog-agent-base':
7678
ensure => absent,
7779
before => Package['datadog-agent'],
7880
}
79-
81+
8082
package { 'datadog-agent':
8183
ensure => $agent_version,
8284
require => [File['/etc/apt/sources.list.d/datadog.list'],
8385
Exec['datadog_apt-get_update']],
8486
}
85-
87+
8688
service { 'datadog-agent':
8789
ensure => $::datadog_agent::service_ensure,
8890
enable => $::datadog_agent::service_enable,

0 commit comments

Comments
 (0)