Skip to content

Commit

Permalink
Fix nodejs dev package name for Ubuntu 20.04
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano authored and mmoll committed May 1, 2020
1 parent e80f45e commit f56b32c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
docker_sets:
- set: ubuntu1604-64
- set: ubuntu1804-64
- set: ubuntu2004-64
- set: centos7-64
- set: centos8-64
- set: debian8-64
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ matrix:
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu2004-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ This module has received limited testing on:

* CentOS/RHEL 6/7/8
* Debian 8
* Ubuntu 16.04/18.04
* Ubuntu 16.04/18.04/20.04

The following platforms should also work, but have not been tested:

Expand Down
11 changes: 11 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif $facts['os']['release']['full'] =~ /^20\.04$/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = 'libnode-dev'
$nodejs_dev_package_ensure = 'absent'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
else {
warning("The ${module_name} module might not work on ${facts['os']['name']} ${facts['os']['release']['full']}. Sensible defaults will be attempted.")
$manage_package_repo = true
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
"18.04",
"20.04"
]
}
],
Expand Down
14 changes: 10 additions & 4 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
false
end

native_debian_devel_package = if facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04'
'libnode-dev'
else
'nodejs-dev'
end

it 'the file resource root_npmrc should be in the catalog' do
is_expected.to contain_file('root_npmrc').with(
'ensure' => 'file',
Expand Down Expand Up @@ -196,11 +202,11 @@
if is_supported_debian_version

it 'the nodejs development package resource should not be present' do
is_expected.not_to contain_package('nodejs-dev')
is_expected.not_to contain_package(native_debian_devel_package)
end
else
it 'the nodejs development package should be installed' do
is_expected.to contain_package('nodejs-dev').with('ensure' => 'present')
is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'present')
end
end
end
Expand All @@ -215,11 +221,11 @@
if is_supported_debian_version

it 'the nodejs development package resource should not be present' do
is_expected.not_to contain_package('nodejs-dev')
is_expected.not_to contain_package(native_debian_devel_package)
end
else
it 'the nodejs development package should not be present' do
is_expected.to contain_package('nodejs-dev').with('ensure' => 'absent')
is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'absent')
end
end
end
Expand Down

0 comments on commit f56b32c

Please sign in to comment.