Skip to content

Commit

Permalink
Further changes based on PR feedback(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
juniorsysadmin committed Dec 3, 2017
1 parent 9bcd158 commit ec19dea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif $facts['os']['release']['full'] =~ /^14.04$|^16.04$/ {
elsif $facts['os']['release']['full'] =~ /^1[46]\.04$/ {
$legacy_debian_symlinks = false
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
Expand Down
16 changes: 3 additions & 13 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@

case $facts['os']['family'] {
'RedHat': {
if $facts['os']['release']['full'] =~ /^6\.(\d+)/ {
$dist_version = '6'
$name_string = 'Enterprise Linux 6'
}

elsif $facts['os']['release']['full'] =~ /^7\.(\d+)/ {
$dist_version = '7'
$name_string = 'Enterprise Linux 7'
if $facts['os']['release']['major'] =~ /^[67]$/ {
$dist_version = $facts['os']['release']['major']
$name_string = "Enterprise Linux ${dist_version}"
}

# Fedora
Expand Down Expand Up @@ -54,11 +49,6 @@
contain '::nodejs::repo::nodesource::yum'

}
'Linux': {
if ($ensure == 'present') {
fail("Unsupported managed NodeSource repository for operatingsystem: ${facts['os']['name']}.")
}
}
'Debian': {
class { '::nodejs::repo::nodesource::apt': }
contain '::nodejs::repo::nodesource::apt'
Expand Down
22 changes: 13 additions & 9 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
facts
end

is_supported_debian_version = if facts[:os]['family'] == 'Debian' && %w[8 9].include?(facts[:os]['release']['major'])
true
else
false
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 @@ -208,8 +214,7 @@
}
end

if facts[:os]['family'] == 'Debian' &&
%w[8 9].include?(facts[:os]['release']['major'])
if is_supported_debian_version

it 'the nodejs development package resource should not be present' do
is_expected.not_to contain_package('nodejs-dev')
Expand All @@ -228,8 +233,7 @@
}
end

if facts[:os]['family'] == 'Debian' &&
%w[8 9].include?(facts[:os]['release']['major'])
if is_supported_debian_version

it 'the nodejs development package resource should not be present' do
is_expected.not_to contain_package('nodejs-dev')
Expand Down Expand Up @@ -274,8 +278,7 @@
}
end

if facts[:os]['family'] == 'Debian' &&
%w[8 9].include?(facts[:os]['release']['major'])
if is_supported_debian_version

it 'the npm package resource should not be present' do
is_expected.not_to contain_package('npm')
Expand All @@ -294,8 +297,7 @@
}
end

if facts[:os]['family'] == 'Debian' &&
%w[8 9].include?(facts[:os]['release']['major'])
if is_supported_debian_version

it 'the npm package resource should not be present' do
is_expected.not_to contain_package('npm')
Expand Down Expand Up @@ -1113,7 +1115,9 @@
'family' => 'RedHat',
'name' => 'Amazon',
'release' => {
'full' => '2015.03'
'full' => '2015.03',
'major' => '2015',
'minor' => '03'
}
}
}
Expand Down

0 comments on commit ec19dea

Please sign in to comment.