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

Upgrade from 4.x to 5.x, Downgrade from 5.x to 4.x #197

Closed
fstr opened this issue Jan 12, 2016 · 4 comments
Closed

Upgrade from 4.x to 5.x, Downgrade from 5.x to 4.x #197

fstr opened this issue Jan 12, 2016 · 4 comments

Comments

@fstr
Copy link
Contributor

fstr commented Jan 12, 2016

Just changing the repo_url_suffix from node_4.x to node_5.x and set ensure to present or latest doesn't do any changes.

Version 4.x will still be installed, since it fulfills the present requirement.

A way to force a new version is to set a certain version.
For an upgrade:

class { 'nodejs':
  manage_package_repo => true,
  repo_url_suffix => 'node_5.x',
  nodejs_package_ensure => '5.4.0-1nodesource1~wheezy1' # or latest
}

latest does not work for a downgrade though, so for a downgrade you have to do something like this:

class { 'nodejs':
  manage_package_repo => true,
  repo_url_suffix => 'node_4.x',
  nodejs_package_ensure => '4.2.4-1nodesource1~wheezy1'
}

Sadly, the apt.pp file only updates the sources if the nodejs_package_ensure is set to present

11:  if ($ensure == 'present') {

Maybe I got it all wrong and there's another way to upgrade/downgrade major versions. Otherwise I'd write a PR.

So I propose a change

11:   if ($ensure != 'absent') {
@igalic
Copy link
Contributor

igalic commented Jan 12, 2016

👍 @fstr!
would you like to provide us with a pull request?

@fstr
Copy link
Contributor Author

fstr commented Jan 12, 2016

I was working with the 0.8.0 release from puppetlabs, you should publish a new release there!

But the problem seems to persist/be slightly different for the latest 1.3.0 release.

When I change the repo_url_suffix from 4.x to 5.x, the sources.list.d file is updated, but no apt-get update is executed. A notify => Exec['apt_update'] when changing the sources.list entry seems to be propagated to be executed AFTER apt-get install

With the change I proposed providing a certain version, the install fails because of the missing apt-get update.

The best fix I found so far, is doing a require => Exec['apt_update'] in install.pp for each package to make sure, that the required versions are available after providing the sources.list.

Example:

  # nodejs
  package { $nodejs::nodejs_package_name:
    ensure => $nodejs::nodejs_package_ensure,
    require  => Exec['apt_update']
  }

I'll try to provide a PR later.

@igalic
Copy link
Contributor

igalic commented Jan 12, 2016

I was working with the 0.8.0 release from puppetlabs, you should publish a new release there!

@fstr puppetlabs/nodejs has been moved to voxpupuli (on the forge this is the /puppet namespace)
we're working together with puppetlabs to make pmt and the forge do redirects.

fstr pushed a commit to fstr/puppet-nodejs that referenced this issue Jan 12, 2016
…ate the

sources.list

Until now only the value 'present' caused a sources.list update. Now
it's possible to also provide a certain version or other values like
'latest'

Only if 'absent' is provided explicitly, the nodejs package will be
purged.
fstr pushed a commit to fstr/puppet-nodejs that referenced this issue Jan 12, 2016
…ackage

Until now when switching between versions (e.g. 4.x to 5.x) the
sources.list was updated, but the command apt-get update was never
executed before trying to install a new package

This patch requires an explicit call to apt-get update before each
package installation, to make sure the latest updates to the
sources.list are used
fstr pushed a commit to fstr/puppet-nodejs that referenced this issue Jan 12, 2016
…ackage

Until now when switching between versions (e.g. 4.x to 5.x) the
sources.list was updated, but the command apt-get update was never
executed before trying to install a new package

This patch requires an explicit call to apt-get update before each
package installation, to make sure the latest updates to the
sources.list are used
juniorsysadmin added a commit that referenced this issue Jan 25, 2016
Making it possible to provide concrete nodejs versions to force upgrade/downgrade (#197)
@juniorsysadmin
Copy link
Member

Proposed fix merged in #198

cegeka-jenkins pushed a commit to cegeka/puppet-nodejs that referenced this issue Oct 23, 2017
…ate the

sources.list

Until now only the value 'present' caused a sources.list update. Now
it's possible to also provide a certain version or other values like
'latest'

Only if 'absent' is provided explicitly, the nodejs package will be
purged.
cegeka-jenkins pushed a commit to cegeka/puppet-nodejs that referenced this issue Oct 23, 2017
Making it possible to provide concrete nodejs versions to force upgrade/downgrade (voxpupuli#197)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants