voxpupuli / puppet-nodejs

Puppet module to install nodejs and global npm packages
https://forge.puppet.com/puppet/nodejs
Apache License 2.0
113 stars 247 forks source link

Unable to install older version if EPEL present #258

Closed tapsboy closed 7 years ago

tapsboy commented 7 years ago

EPEL recently updated the current node version available there. More info here (https://fedoramagazine.org/node-js-6-x-lts-coming-epel-7/)

As a result, when puppet runs /bin/yum -d 0 -e 0 -y install nodejs, it installs the one available in EPEL and not the one requested by the module. This wasn't a problem earlier as EPEL was on 0.10.

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

  class { 'nodejs':
    repo_url_suffix => '0.10'
  } 

Or

  class { 'nodejs':
    repo_url_suffix => '4.x'
  } 

What are you seeing

It always installs latest version from v6 branch

What behaviour did you expect instead

The version specified, while requiring the nodejs class

Any additional information you'd like to impart

I believe this is happening because the module doesn't specify the source or exact version to be picked up in the install.pp

  # nodejs
  package { $nodejs::nodejs_package_name:
    ensure => $nodejs::nodejs_package_ensure,
    tag    => 'nodesource_repo',
  }
tapsboy commented 7 years ago

For now, I have been able to do the following:

  class { 'nodejs':
    repo_url_suffix => '0.10',
    nodejs_package_ensure => "0.10.*",
  } 

and

  class { 'nodejs':
    repo_url_suffix => '4,x',
    nodejs_package_ensure => "4.*",
  } 
gigi-at-zymergen commented 7 years ago

I had nodes that were running a really old version (0.10 ), which I was trying to upgrade to 6.x and had only specified the repo_url_suffix based on the module README.md . This worked great on test nodes that had no previous install, however it skipped the install on the nodes that had an old version. @tapsboy solution worked great for me, but took a little digging to find it. The nodejs_package_ensure parameter is listed in the README.md, but might be good to emphasize that it defaults to present and specifying a repo_url_suffix is not sufficient to ensure a specific major version.

juniorsysadmin commented 7 years ago

322