|
1 | 1 | # PRIVATE CLASS: Do not use directly. |
2 | 2 | class nodejs::repo::nodesource::apt { |
3 | 3 | $ensure = $nodejs::repo::nodesource::ensure |
4 | | - $pin = $nodejs::repo::nodesource::pin |
| 4 | + $priority = $nodejs::repo::nodesource::priority |
5 | 5 | $url_suffix = $nodejs::repo::nodesource::url_suffix |
6 | 6 |
|
7 | 7 | include apt |
8 | 8 |
|
9 | 9 | if ($ensure != 'absent') { |
| 10 | + apt::keyring { 'nodesource': |
| 11 | + source => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key', |
| 12 | + filename => 'nodesource-repo.gpg.key.asc', |
| 13 | + } |
| 14 | + |
10 | 15 | apt::source { 'nodesource': |
11 | | - key => { |
12 | | - 'name' => 'nodesource-repo.gpg.key.asc', |
13 | | - 'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key', |
14 | | - }, |
15 | | - location => "https://deb.nodesource.com/node_${url_suffix}", |
16 | | - pin => $pin, |
17 | | - release => 'nodistro', |
18 | | - repos => 'main', |
| 16 | + source_format => 'sources', |
| 17 | + location => ["https://deb.nodesource.com/node_${url_suffix}",], |
| 18 | + keyring => '/etc/apt/keyrings/nodesource-repo.gpg.key.asc', |
| 19 | + release => ['nodistro',], |
| 20 | + repos => ['main',], |
| 21 | + types => ['deb',], |
| 22 | + require => Apt::Keyring['nodesource'], |
| 23 | + } |
| 24 | + |
| 25 | + apt::pin { 'nodesource': |
| 26 | + origin => 'deb.nodesource.com', |
| 27 | + priority => $priority, |
19 | 28 | } |
20 | 29 |
|
21 | 30 | Apt::Source['nodesource'] -> Package<| tag == 'nodesource_repo' |> |
|
26 | 35 | apt::source { 'nodesource': |
27 | 36 | ensure => 'absent', |
28 | 37 | } |
| 38 | + # Workaround https://github.com/puppetlabs/puppetlabs-apt/issues/1245 |
| 39 | + file { '/etc/apt/sources.list.d/nodesource.sources': |
| 40 | + ensure => 'absent', |
| 41 | + notify => Class['Apt::Update'], |
| 42 | + } |
| 43 | + apt::pin { 'nodesource': |
| 44 | + ensure => 'absent', |
| 45 | + } |
| 46 | + apt::keyring { 'nodesource': |
| 47 | + ensure => 'absent', |
| 48 | + filename => 'nodesource-repo.gpg.key.asc', |
| 49 | + } |
29 | 50 | } |
30 | 51 | } |
0 commit comments