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

The RPM repo is no longer accessible #24

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 2 additions & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ project_page 'https://github.com/puppetlabs/puppetlabs-nodejs'
# dependency 'username/name', '>= 1.2.0'
dependency 'puppetlabs/apt', '>= 0.0.3'
dependency 'puppetlabs/stdlib', '>= 2.0.0'
dependency 'maestrodev/wget', '>= 0.0.0'

4 changes: 2 additions & 2 deletions lib/puppet/provider/package/npm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def install
end

if resource[:source]
npm('install', '--global', resource[:source])
npm('install', '--global', '--force', resource[:source])
else
npm('install', '--global', package)
npm('install', '--global', '--force', package)
end
end

Expand Down
73 changes: 49 additions & 24 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,57 @@
before => Anchor['nodejs::repo'],
}
}
package { 'nodejs':
name => $nodejs::params::node_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}

package { 'npm':
name => $nodejs::params::npm_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}

if $dev_package and $nodejs::params::dev_pkg {
package { 'nodejs-dev':
name => $nodejs::params::dev_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}
}
}

'Fedora', 'RedHat', 'CentOS', 'Amazon': {
package { 'nodejs-stable-release':
ensure => present,
source => $nodejs::params::pkg_src,
provider => 'rpm',
before => Anchor['nodejs::repo'],
# wget from https://github.com/maestrodev/puppet-wget
include wget
wget::fetch { "nodejs":
source => $pkg_src,
destination => $nodejs_tarball,
notify => Exec['nodejs_unpack'],
} ->
exec { 'nodejs_unpack':
command => "tar zxf ${nodejs_tarball}",
cwd => '/usr/local',
creates => $install_dir,
} ->
file { '/usr/local/node':
ensure => link,
target => $install_dir
} ->
file { '/usr/bin/node':
ensure => link,
target => '/usr/local/node/bin/node',
} ->
file { '/usr/bin/npm':
ensure => link,
target => '/usr/local/node/bin/npm',
} ->
file { '/usr/bin/node-waf':
ensure => link,
target => '/usr/local/node/bin/node-waf',
}

}

default: {
Expand All @@ -56,18 +98,7 @@
# anchor resource provides a consistent dependency for prereq.
anchor { 'nodejs::repo': }

package { 'nodejs':
name => $nodejs::params::node_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}

package { 'npm':
name => $nodejs::params::npm_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}


if $proxy {
exec { 'npm_proxy':
command => "npm config set proxy ${proxy}",
Expand All @@ -76,12 +107,6 @@
}
}

if $dev_package and $nodejs::params::dev_pkg {
package { 'nodejs-dev':
name => $nodejs::params::dev_pkg,
ensure => present,
require => Anchor['nodejs::repo']
}
}


}
26 changes: 9 additions & 17 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Usage:
#
class nodejs::params {
class nodejs::params($version = '0.8.16') {

case $::operatingsystem {
'Debian', 'Ubuntu': {
Expand All @@ -23,22 +23,14 @@
$dev_pkg = 'nodejs-devel'
}

'RedHat', 'CentOS': {
$node_pkg = 'nodejs-compat-symlinks'
$npm_pkg = 'npm'
$pkg_src = 'http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm'
}

'Fedora': {
$node_pkg = 'nodejs-compat-symlinks'
$npm_pkg = 'npm'
$pkg_src = 'http://nodejs.tchol.org/repocfg/fedora/nodejs-stable-release.noarch.rpm'
}

'Amazon': {
$node_pkg = 'nodejs-compat-symlinks'
$npm_pkg = 'npm'
$pkg_src = 'http://nodejs.tchol.org/repocfg/amzn1/nodejs-stable-release.noarch.rpm'
'RedHat', 'CentOS', 'Fedora', 'Amazon': {
$node_arch = $::architecture ? { 'x86_64' => 'x64', default => 'x86' }
# These pkg names will not be needed until a new repo becomes available
$node_pkg = 'nodejs-compat-symlinks'
$npm_pkg = 'npm'
$pkg_src = "http://nodejs.org/dist/v${version}/node-v${version}-linux-${node_arch}.tar.gz"
$nodejs_tarball = "/usr/local/src/node-v${version}-linux-${node_arch}.tar.gz"
$install_dir = "/usr/local/node-v${version}-linux-${node_arch}"
}

default: {
Expand Down