GithubHelp home page GithubHelp logo

artberri / puppet-nvm Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 30.0 42 KB

Puppet Module to install Node.js with Node Version Manager (NVM)

License: Apache License 2.0

Ruby 70.09% Puppet 27.02% Shell 2.89%

puppet-nvm's Introduction

Hi there ๐Ÿ‘‹

I'm Alberto Varela, a full stack developer based in Bilbao

  • ๐Ÿ’ป Iโ€™m currently working at Paired as Senior Software Engineer to make couple relationships happier and healthier.
  • ๐Ÿ’Œ You can reach me via @artberri on Twitter or write me an email to [email protected]
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง Father of two brave twins
  • โšก My website: albertovarela.net

puppet-nvm's People

Contributors

artberri avatar jimihford avatar s12v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

puppet-nvm's Issues

how to interact with the installed nvm

Hi,

I want to run an 'exec' command against my installation of nvm to make it install the latest version of npm after nvm is installed. In my manifest I have the following:

  class { 'nvm':
    user =>  'root',
    nvm_dir =>  '/opt/nvm',
    version =>  'v0.34.0',
    profile_path =>  '/etc/profile.d/nvm.sh',
    install_node =>  '6.11.3',
  }

  exec { "install latest npm":
    path => "/opt/nvm",
    command => "nvm install-latest-npm",
    require => [Class["nvm"]],
  }

However, when I try to provision using this I get the error:

Could not find command 'nvm'

Do you know of a way that I can run an exec against nvm? I am aware that because it's script-based it doesn't behave like a 'traditional' command-line tool (e.g. in terms of being recognised by commands like 'which').

Incompatibility with stdlib 4.16.0

Installing puppet-nvm via Vagrant i'm getting the following error:

 Error: /Stage[main]/Nvm/File_line[add NVM_DIR to profile file]: Could not evaluate: can't convert Hash into String
==> VerticalServer: /etc/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb:43:in `readlines'
==> VerticalServer: /etc/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb:43:in `lines'
==> VerticalServer: /etc/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb:6:in `exists?'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/property/ensure.rb:81:in `retrieve'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1035:in `retrieve'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1063:in `retrieve_resource'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:223:in `from_resource'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:19:in `evaluate'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:174:in `apply'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:187:in `eval_resource'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `call'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `evaluate'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:327:in `thinmark'
==> VerticalServer: /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:326:in `thinmark'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `evaluate'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/graph/relationship_graph.rb:118:in `traverse'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:108:in `evaluate'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:164:in `apply'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util/log.rb:149:in `with_destination'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/transaction/report.rb:112:in `as_logging_destination'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:163:in `apply'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:125:in `apply_catalog'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:161:in `benchmark'
==> VerticalServer: /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:160:in `benchmark'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:124:in `apply_catalog'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:195:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:288:in `apply_catalog'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:228:in `main'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/context.rb:51:in `override'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet.rb:233:in `override'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:190:in `main'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:151:in `run_command'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:372:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:479:in `plugin_hook'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:372:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:479:in `exit_on_fail'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:372:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/context.rb:51:in `override'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet.rb:233:in `override'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:362:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:137:in `run'
==> VerticalServer: /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:91:in `execute'
==> VerticalServer: /usr/bin/puppet:4

However, if I downgrade stdlib to version 4.15.0 puppet-nvm is applied correctly without error.

Please let me know if you need any more info!

Renewing Puppet Forge Approved Status

Hey @artberri ,

Here at puppetlabs, we are currently going through all of our Approved modules on the Puppet Forge. We have some feedback for your module if you would be interested in retaining the approved status. If you are keen on keeping your approved status please ensure you respond as soon as you possibly can.

Many Thanks
The Puppet Approvals Committee.

Puppet module reports missing dependency

Puppet module command complains about missing dependency

# puppet module list
Warning: Missing dependency 'puppetlabs-stdlib':
  'artberri-nvm' (v1.1.1) requires 'puppetlabs-stdlib' (>= 3.2.0 < 5.0.0)

Make class nvm a resource

Currently it is not possible to add nvm to more than one user because nvm is a class and not a resource

To reproduce, let users be an array of usernames and versions an array of node.js versions:

each( $nvm['users'] ) |$user| {
    class { 'nvm':
      user => $user
    }

    each( $nvm['versions'] ) |$version| {
      nvm::node::install { $version:
        user => $user,
        require => Class['nvm']
      }
    }
  }

nvm Warnings of deprecated methods

nvm throw some warnings

My Puppetfile with the last versions

forge 'https://forge.puppet.com'

# Modules discovered by generate-puppetfile
mod 'puppetlabs/accounts', '1.3.0'
mod 'puppetlabs/ntp',      '7.1.1'
mod 'puppetlabs/stdlib',   '4.25.1'
mod 'saz/sudo',            '5.0.0'
mod 'saz/timezone',        '4.1.1'
mod 'stm/debconf',         '2.2.0'
mod 'artberri-nvm',        '1.1.1'

Warnings of deprecated methods

Warning: This method is deprecated, please use the stdlib validate_legacy function,
                    with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/production/modules/nvm/manifests/init.pp", 41]:["/etc/puppetlabs/code/environments/production/manifests/site.pp", 1]
   (location: /etc/puppetlabs/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb:28:in `deprecation')
Warning: This method is deprecated, please use the stdlib validate_legacy function,
                    with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/production/modules/nvm/manifests/init.pp", 46]:["/etc/puppetlabs/code/environments/production/manifests/site.pp", 1]
   (location: /etc/puppetlabs/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb:28:in `deprecation')
Warning: This method is deprecated, please use the stdlib validate_legacy function,
                    with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/production/modules/nvm/manifests/init.pp", 52]:["/etc/puppetlabs/code/environments/production/manifests/site.pp", 1]

Update functionality

Hey,

I was wondering if this module should have the possibility to update the installed version by itself.
Since not all supported systems support systemd, I would suggest using https://puppet.com/docs/puppet/6/types/schedule.html to trigger the updates on a regular basis.
The old versions should probably removed (optionally) during that process.

What do you think about it?

I am testing the waters here. I do not want to invest time, if that is not a wanted feature for this module or if it is inactive.

Dependency Error

I am getting this but I am not sure what this means.
Error: Execution of '/bin/rpm -e npm' returned 1: error: Failed dependencies:
npm = 1:3.10.10-1.6.17.1.1.el7 is needed by (installed) nodejs-1:6.17.1-1.el7.x86_64
Error: /Stage[main]/Nodejs::Install/Package[npm]/ensure: change from '1:3.10.10-1.6.17.1.1.el7' to 'absent' failed: Execution of '/bin/rpm -e npm' returned 1: error: Failed dependencies:
npm = 1:3.10.10-1.6.17.1.1.el7 is needed by (installed) nodejs-1:6.17.1-1.el7.x86_64

If it is asking for a newer version of NPM, how do I specify that in the module?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.