|
33 | 33 | } |
34 | 34 |
|
35 | 35 | # 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' { |
38 | 41 | exec { 'datadog_apt-get_remove_agent6': |
39 | 42 | command => '/usr/bin/apt-get remove -y -q datadog-agent', |
40 | 43 | } |
|
47 | 50 | } |
48 | 51 | } |
49 | 52 |
|
50 | | - if $facts['agent6_beta_repo'] { |
| 53 | + if $::apt_agent6_beta_repo { |
51 | 54 | file { '/etc/apt/sources.list.d/datadog-beta.list': |
52 | 55 | ensure => absent, |
53 | 56 | } |
54 | 57 | } |
55 | 58 |
|
56 | 59 | file { '/etc/apt/sources.list.d/datadog.list': |
| 60 | + ensure => file, |
57 | 61 | owner => 'root', |
58 | 62 | group => 'root', |
59 | | - ensure => file, |
60 | 63 | content => template('datadog_agent/datadog.list.erb'), |
61 | 64 | notify => [Exec['datadog_apt-get_remove_agent6'], |
62 | 65 | Exec['datadog_apt-get_update']], |
63 | 66 | require => Package['apt-transport-https'], |
64 | 67 | } |
65 | | - |
| 68 | + |
66 | 69 | exec { 'datadog_apt-get_update': |
67 | 70 | command => '/usr/bin/apt-get update', |
68 | 71 | refreshonly => true, |
|
71 | 74 | require => File['/etc/apt/sources.list.d/datadog.list'], |
72 | 75 | } |
73 | 76 |
|
74 | | - |
75 | 77 | package { 'datadog-agent-base': |
76 | 78 | ensure => absent, |
77 | 79 | before => Package['datadog-agent'], |
78 | 80 | } |
79 | | - |
| 81 | + |
80 | 82 | package { 'datadog-agent': |
81 | 83 | ensure => $agent_version, |
82 | 84 | require => [File['/etc/apt/sources.list.d/datadog.list'], |
83 | 85 | Exec['datadog_apt-get_update']], |
84 | 86 | } |
85 | | - |
| 87 | + |
86 | 88 | service { 'datadog-agent': |
87 | 89 | ensure => $::datadog_agent::service_ensure, |
88 | 90 | enable => $::datadog_agent::service_enable, |
|
0 commit comments