diff --git a/manifests/init.pp b/manifests/init.pp index 1c68ed73..8570b630 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -139,12 +139,14 @@ 'Ubuntu': { # The PPA we are using on Ubuntu includes NPM in the nodejs package, hence # we must not install it separately + $npm_require = 'Package[nodejs]' } 'Gentoo': { # Gentoo installes npm with the nodejs package when configured properly. # We use the gentoo/portage module since it is expected to be # available on all gentoo installs. + $npm_require = 'Package[nodejs]' package_use { $nodejs::params::node_pkg: ensure => present, use => 'npm', @@ -153,6 +155,7 @@ } 'Archlinux': { + $npm_require = 'Package[nodejs]' # Archlinux installes npm with the nodejs package. } @@ -162,11 +165,8 @@ name => $npm_pkg, require => Anchor['nodejs::repo'] } + $npm_require = 'Package[npm]' } - $npm_require = 'Package[npm]' - } else - { - $npm_require = 'Package[nodejs]' } if $proxy { diff --git a/spec/classes/nodejs_spec.rb b/spec/classes/nodejs_spec.rb index 48112a00..4e5970c6 100644 --- a/spec/classes/nodejs_spec.rb +++ b/spec/classes/nodejs_spec.rb @@ -236,7 +236,27 @@ end - describe 'when deploying with proxy' do + describe 'when deploying with proxy on CentOS' do + let :facts do + { + :operatingsystem => 'CentOS', + :lsbdistcodename => 'Final', + :lsbdistid => 'CentOS', + } + end + + let :params do + { :proxy => 'http://proxy.puppetlabs.lan:80/' } + end + + it { should contain_exec('npm_proxy').with({ + 'command' => 'npm config set proxy http://proxy.puppetlabs.lan:80/', + 'require' => 'Package[npm]', + }) } + it { should_not contain_package('nodejs-stable-release') } + end + + describe 'when deploying with proxy on Ubuntu' do let :facts do { :operatingsystem => 'Ubuntu', @@ -252,7 +272,7 @@ it { should_not contain_package('npm') } it { should contain_exec('npm_proxy').with({ 'command' => 'npm config set proxy http://proxy.puppetlabs.lan:80/', - 'require' => 'Package[npm]', + 'require' => 'Package[nodejs]', }) } it { should_not contain_package('nodejs-stable-release') } end