Remove distro-package npm from release slave.

This patch removes munged-up install pieces from the release slave,
in order to clean up before using the nodejs puppet module.

Included are:
* The pseudo-locally installed npm.
* The package installed npm.
* The unmanaged node_modules directories from each.
* The .npm cache created for the root user
* The misplaced global npmrc

The jenkins user .npmrc template is retained, to maintain blame
history for the subsequent patch.

Change-Id: Icffc6674e8795a04d17289cce460b96f18bb9526
This commit is contained in:
Michael Krotscheck 2015-09-28 17:03:30 -07:00
parent 0681fd819d
commit 4b1b542322
2 changed files with 15 additions and 38 deletions

View File

@ -53,28 +53,25 @@ class openstack_project::release_slave (
require => Class['pip'],
}
package { ['nodejs', 'nodejs-legacy', 'npm']:
ensure => latest,
before => [
Exec['upgrade npm']
]
exec { 'uninstall /usr/local/bin/npm':
command => 'npm uninstall npm --prefix=/usr/local -g',
onlyif => 'test -d /usr/local/lib/node_modules',
path => '/usr/local/bin:/usr/bin',
}
exec { 'assert npm@2':
command => 'npm install npm@2 -g --upgrade',
path => '/usr/local/bin:/usr/bin',
onlyif => '[ `npm --version | cut -c 1` = "1" ]',
require => [
Package['npm'],
File['/etc/npmrc'],
],
package { ['npm', 'nodejs', 'nodejs-legacy']:
ensure => purged,
require => Exec['uninstall /usr/local/bin/npm'],
}
exec { 'upgrade npm':
command => 'npm install npm -g --upgrade',
path => '/usr/local/bin:/usr/bin',
onlyif => '[ `npm view npm version` != `npm --version` ]',
require => Exec['assert npm@2'],
file { ['/usr/share/npm',
'/usr/lib/node_modules',
'/root/.npm',
'/etc/npmrc',
'/home/jenkins/.npmrc']:
ensure => absent,
force => true,
require => Package['npm']
}
file { '/home/jenkins/.pypirc':
@ -86,23 +83,6 @@ class openstack_project::release_slave (
require => File['/home/jenkins'],
}
file { '/home/jenkins/.npmrc':
ensure => present,
owner => 'jenkins',
group => 'jenkins',
mode => '0600',
content => template('openstack_project/npmrc_jenkins.erb'),
require => File['/home/jenkins'],
}
file { '/etc/npmrc':
ensure => present,
owner => 'root',
group => 'root',
mode => '0666',
content => template('openstack_project/npmrc_global.erb'),
}
file { '/home/jenkins/.jenkinsci-curl':
ensure => present,
owner => 'jenkins',

View File

@ -1,3 +0,0 @@
tag-version-prefix=
sign-git-tag=true
prefix=/usr/local