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

View File

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