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

Making it possible to provide concrete nodejs versions to force upgrade/downgrade (#197) #198

Merged
merged 1 commit into from
Jan 25, 2016

Conversation

fstr
Copy link
Contributor

@fstr fstr commented Jan 12, 2016

This fixes issue #197

It is now possible to upgrade/downgrade in Debian providing (forcing) a certain version. It's also possible to use 'latest', but using latest will not downgrade your version if you want to.

upgrade

class { 'nodejs':
  manage_package_repo => true,
  repo_url_suffix => '5.x',
  nodejs_package_ensure => 'latest'
}

upgrade

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

downgrade

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

…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
Copy link
Contributor Author

fstr commented Jan 12, 2016

I tried executing the existing tests with bundle exec rspec

/Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/hiera/scope.rb:1:in `<top (required)>': Hiera is not a class (TypeError)
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/indirector/hiera.rb:2:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/indirector/hiera.rb:2:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/indirector/data_binding/hiera.rb:1:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/indirector/data_binding/hiera.rb:1:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/test/test_helper.rb:1:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/puppet-3.8.4/lib/puppet/test/test_helper.rb:1:in `<top (required)>'
    from /Users/florian/.bundler/ruby/2.0.0/rspec-puppet-7ab588ecdd1e/lib/rspec-puppet.rb:12:in `require'
    from /Users/florian/.bundler/ruby/2.0.0/rspec-puppet-7ab588ecdd1e/lib/rspec-puppet.rb:12:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/puppetlabs_spec_helper-1.0.1/lib/puppetlabs_spec_helper/module_spec_helper.rb:1:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/puppetlabs_spec_helper-1.0.1/lib/puppetlabs_spec_helper/module_spec_helper.rb:1:in `<top (required)>'
    from /Users/florian/puppet-nodejs/spec/spec_helper.rb:1:in `require'
    from /Users/florian/puppet-nodejs/spec/spec_helper.rb:1:in `<top (required)>'
    from /Users/florian/puppet-nodejs/spec/classes/nodejs_spec.rb:1:in `require'
    from /Users/florian/puppet-nodejs/spec/classes/nodejs_spec.rb:1:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1361:in `load'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1361:in `block in load_spec_files'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1359:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1359:in `load_spec_files'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:102:in `setup'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:88:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:73:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:41:in `invoke'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.4.1/exe/rspec:4:in `<top (required)>'
    from /usr/local/bin/rspec:23:in `load'
    from /usr/local/bin/rspec:23:in `<main>'

This error seems unrelated to my patch though (imo).
OSX 10.11.2
VirtualBox 5.0.10

I am not that experienced in Ruby/Puppet so I don't really know how to solve it.

@rnelson0
Copy link
Member

@fstr You want to run bundle exec rake test, or bundle exec rake -T to see the individual tasks to run (like syntax or rubocop).

@fstr fstr changed the title Patch for issue #197 Making it possible to provide concrete nodejs versions to force upgrade/downgrade (#197) Jan 12, 2016
@juniorsysadmin
Copy link
Member

What's wrong with just having the change: ($ensure != 'absent') ?
There are other operating system families using this module other Debian ones, so we can't just sprinkle apt-update references everywhere.
Perhaps the root cause of downgrades not working even when the repo_url_suffix and nodejs_package_ensure is changed is the value of the apt update frequency (https://github.com/puppetlabs/puppetlabs-apt#update-the-list-of-packages), no?

@fstr
Copy link
Contributor Author

fstr commented Jan 13, 2016

I have my update frequency on always. I investigated this problem again and you are right.

The apt-get update call is not needed.

The install failed because the nodesource repository updated from 5.4.0-1nodesource1~wheezy1 to 5.4.1-1nodesource1~wheezy1 while I was working on the module. Since they always only keep one version in the repository, but I used a fixed version, it suddenly didn't work anymore.

So for upgrading it would be:

class { 'nodejs':
  manage_package_repo => true,
  repo_url_suffix => '5.x',
  nodejs_package_ensure => 'latest'
}

For downgrading it would be:

class { 'nodejs':
  manage_package_repo => true,
  repo_url_suffix => '4.x',
  nodejs_package_ensure => '4.2.4-1nodesource1~wheezy1' # get the version from the repository URL (latest or present doesn't work here when downgrading)
}

I will remove the commit with the apt-get update changes later.

@juniorsysadmin
Copy link
Member

@fstr Ready to merge?

@fstr
Copy link
Contributor Author

fstr commented Jan 25, 2016

yes

juniorsysadmin added a commit that referenced this pull request Jan 25, 2016
Making it possible to provide concrete nodejs versions to force upgrade/downgrade (#197)
@juniorsysadmin juniorsysadmin merged commit 1f4a56a into voxpupuli:master Jan 25, 2016
cegeka-jenkins pushed a commit to cegeka/puppet-nodejs that referenced this pull request 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

Successfully merging this pull request may close these issues.

3 participants