Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace repo_url_suffix with repo_version #487

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ rather than 20.x on Debian/RHEL platforms:

```puppet
class { 'nodejs':
repo_url_suffix => '21.x',
repo_version => '21',
}
```

See the `repo_url_suffix` parameter entry below for possible values.
See the `repo_version` parameter entry below for possible values.

## Usage

Expand Down Expand Up @@ -91,15 +91,15 @@ class { '::nodejs':
### Upgrades

The parameter `nodejs_package_ensure` defaults to `installed`. Changing the
`repo_url_suffix` will not result in a new version being installed. Changing
`repo_version` will not result in a new version being installed. Changing
the `nodejs_package_ensure` parameter should provide the desired effect.

For example:

```puppet
# Upgrade from nodejs 5.x to 6.x
class { 'nodejs':
repo_url_suffix => '6.x',
repo_version => '6',
nodejs_package_ensure => '6.12.2',
}
```
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
$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,
String[1] $repo_version = $nodejs::params::repo_version,
Array $use_flags = $nodejs::params::use_flags,
Optional[String] $package_provider = $nodejs::params::package_provider,
) inherits nodejs::params {
Expand Down
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_release = undef
$repo_url_suffix = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? {
true => '16.x',
default => '20.x',
$repo_version = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? {
true => '16',
default => '20',
}
$use_flags = ['npm', 'snapshot']

Expand Down
3 changes: 2 additions & 1 deletion manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
$proxy_password = $nodejs::repo_proxy_password
$proxy_username = $nodejs::repo_proxy_username
$release = $nodejs::repo_release
$url_suffix = $nodejs::repo_url_suffix

$url_suffix = "${nodejs::repo_version}.x"

case $facts['os']['family'] {
'RedHat': {
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@
end
end

context 'and repo_url_suffix set to 9.x' do
context 'and repo_version set to 9' do
let :params do
default_params.merge!(repo_url_suffix: '9.x')
default_params.merge!(repo_version: '9')
end

it 'the repo apt::source resource should contain location = https://deb.nodesource.com/node_9.x' do
Expand Down Expand Up @@ -372,9 +372,9 @@
end
end

context 'and repo_url_suffix set to 5.x' do
context 'and repo_version set to 5' do
let :params do
default_params.merge!(repo_url_suffix: '5.x')
default_params.merge!(repo_version: '5')
end

it "the yum nodesource repo resource should contain baseurl = https://rpm.nodesource.com/pub_5.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch" do
Expand Down
Loading