|
32 | 32 | } |
33 | 33 | } |
34 | 34 |
|
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 | + } |
37 | 57 | } |
38 | 58 |
|
39 | 59 | file { '/etc/apt/sources.list.d/datadog.list': |
| 60 | + ensure => file, |
40 | 61 | owner => 'root', |
41 | 62 | group => 'root', |
42 | 63 | 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']], |
44 | 66 | require => Package['apt-transport-https'], |
45 | 67 | } |
46 | 68 |
|
|
49 | 71 | refreshonly => true, |
50 | 72 | tries => 2, # https://bugs.launchpad.net/launchpad/+bug/1430011 won't get fixed until 16.04 xenial |
51 | 73 | try_sleep => 30, |
52 | | - require => File['/etc/apt/sources.list.d/datadog-beta.list'], |
| 74 | + require => File['/etc/apt/sources.list.d/datadog.list'], |
53 | 75 | } |
54 | 76 |
|
55 | 77 | package { 'datadog-agent-base': |
|
70 | 92 | pattern => 'dd-agent', |
71 | 93 | require => Package['datadog-agent'], |
72 | 94 | } |
73 | | - |
74 | 95 | } |
0 commit comments