Skip to content

Commit

Permalink
Merge pull request #349 from juniorsysadmin/repo-release
Browse files Browse the repository at this point in the history
Add repo_release parameter
  • Loading branch information
juniorsysadmin committed Jan 4, 2018
2 parents e0b6645 + 37c3234 commit 2f7a4d5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,17 @@ Password for the proxy used by the repository, if required.

User for the proxy used by the repository, if required.

#### `repo_release`

Optional value to override the apt distribution release. Defaults to `undef`
which will autodetect the distribution. If a value is specified, this will
change the NodeSource apt repository distribution.
This is useful if the distribution name does not exist in the NodeSource
repositories. For example, the Ubilinux distribution release name 'dolcetto'
does not exist in NodeSource, but is a derivative of Debian 9 (Stretch).
Setting this value to `stretch` allows NodeSource repository management to
then work as expected on these systems.

#### `repo_url_suffix`

Defaults to ```0.10``` which means that the latest NodeSource 0.10.x release
Expand Down Expand Up @@ -528,6 +539,7 @@ The following platforms should also work, but have not been tested:
* Gentoo
* OpenBSD
* OpenSuse/SLES
* Ubilinux
* Windows

### Module dependencies
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$repo_proxy = $nodejs::params::repo_proxy,
$repo_proxy_password = $nodejs::params::repo_proxy_password,
$repo_proxy_username = $nodejs::params::repo_proxy_username,
Optional[String] $repo_release = $nodejs::params::repo_release,
$repo_url_suffix = $nodejs::params::repo_url_suffix,
Array $use_flags = $nodejs::params::use_flags,
Optional[String] $package_provider = $nodejs::params::package_provider,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$repo_proxy = 'absent'
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_release = undef
$repo_url_suffix = '0.10'
$use_flags = ['npm', 'snapshot']

Expand Down
1 change: 1 addition & 0 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$proxy = $nodejs::repo_proxy
$proxy_password = $nodejs::repo_proxy_password
$proxy_username = $nodejs::repo_proxy_username
$release = $nodejs::repo_release
$url_suffix = $nodejs::repo_url_suffix

case $facts['os']['family'] {
Expand Down
3 changes: 2 additions & 1 deletion manifests/repo/nodesource/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$enable_src = $nodejs::repo::nodesource::enable_src
$ensure = $nodejs::repo::nodesource::ensure
$pin = $nodejs::repo::nodesource::pin
$release = $nodejs::repo::nodesource::release
$url_suffix = $nodejs::repo::nodesource::url_suffix

include ::apt
Expand All @@ -19,7 +20,7 @@
},
location => "https://deb.nodesource.com/node_${url_suffix}",
pin => $pin,
release => $::lsbdistcodename,
release => $release,
repos => 'main',
}

Expand Down
10 changes: 10 additions & 0 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
end
end

context 'and repo_release set to stretch' do
let :params do
default_params.merge!(repo_release: 'stretch')
end

it 'the repo apt::source resource should contain release = stretch' do
is_expected.to contain_apt__source('nodesource').with('release' => 'stretch')
end
end

context 'and repo_pin not set' do
let :params do
default_params.merge!(repo_pin: :undef)
Expand Down

0 comments on commit 2f7a4d5

Please sign in to comment.