alup / puppet-rbenv Goto Github PK
View Code? Open in Web Editor NEWPuppet manifest for rbenv installation
License: MIT License
Puppet manifest for rbenv installation
License: MIT License
Hi,
since most people using puppet are probably behind a proxy, it would be great if the various exec's in your module would allow to set a proxy somehow.
I know that a proxy can be set in puppet.conf or even as environment variables, but that would set the proxy for the whole puppet run including all resources, which is clearly not what I would like to have (or even can ... some resources like e.g. internal repositories fails if connected via proxy).
Unfortunately, your init.pp is empty and collection of losely connected defined types might not easily allow for a proxy to be set with an Exec{} statement somewhere, but maybe you have a better idea?
Cheers,
Sven
I want to install specific versions of gems,
rbenv::gem { "rails":
user => "xdeploy",
ruby => "1.9.3-p327",
version => "3.2.15",
}
Error: Invalid parameter version
There seems to be no way to pass in versions?
When I use the following require statement in lib/puppet/type/rbenvgem.rb
:
provider_path = File.expand_path('../../provider/rbenvgem', __FILE__)
require provider_path # Do not EVER forget the require when developing puppet
I get the following error when running puppet module build
:
/home/alup/mycode/puppet-rbenv/lib/puppet/provider/rbenvgem.rb:1:in `<top (required)>': undefined method `provide' for nil:NilClass (NoMethodError)
from /home/alup/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
...
If we were using classes we could have a base params class like this to avoid this kind of duplication. Is there anything we could do to have something similar for our defined resources?
rbenv::compile and rbenv:gem cause changes every puppet run.
puppet 2.6
debian 7
debug: /Stage[main]//Node[dev-redmine]/Rbenv::Compile[1.9.3-p327]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::root]/Rbenv::Plugin[rbenv::plugin::rubybuild::root]/Exec[rbenv::plugin::update root ruby-build]: Executing check 'git status'
debug: Executing 'git status'
debug: /Stage[main]//Node[dev-redmine]/Rbenv::Compile[1.9.3-p327]/Exec[rbenv::rehash root 1.9.3-p327]: Executing check '[ -e '/var/vhost/dev-redmine/.rbenv/.rehash' ]'
debug: Executing '[ -e '/var/vhost/dev-redmine/.rbenv/.rehash' ]'
debug: Puppet::Type::Rbenvgem::ProviderDefault: Executing '/bin/su - root -c RBENV_VERSION=1.9.3-p327 /var/vhost/dev-redmine/.rbenv/versions/1.9.3-p327/bin/gem list --local bundler$'
debug: Puppet::Type::Rbenvgem::ProviderDefault: Executing '/bin/su - root -c RBENV_VERSION=1.9.3-p327 /var/vhost/dev-redmine/.rbenv/versions/1.9.3-p327/bin/gem install --no-rdoc --no-ri bundler'
notice: /Stage[main]//Node[dev-redmine]/Rbenv::Compile[1.9.3-p327]/Rbenv::Gem[rbenv::bundler root 1.9.3-p327]/Rbenvgem[root/1.9.3-p327/bundler/present]/ensure: created
debug: Puppet::Type::Rbenvgem::ProviderDefault: Executing '/bin/su - root -c RBENV_VERSION=1.9.3-p327 /var/vhost/dev-redmine/.rbenv/versions/1.9.3-p327/bin/gem list --local puma$'
debug: Puppet::Type::Rbenvgem::ProviderDefault: Executing '/bin/su - root -c RBENV_VERSION=1.9.3-p327 /var/vhost/dev-redmine/.rbenv/versions/1.9.3-p327/bin/gem install --no-rdoc --no-ri puma'
notice: /Stage[main]//Node[dev-redmine]/Rbenv::Gem[puma]/Rbenvgem[root/1.9.3-p327/puma/present]/ensure: created
from my node definition:
rbenv::install { 'root':
group => 'root',
home => '/var/vhost/dev-redmine',
}
rbenv::compile { '1.9.3-p327':
user => 'root',
home => '/var/vhost/dev-redmine',
}
rbenv::gem { 'puma':
user => 'root',
ruby => '1.9.3-p327',
home => '/var/vhost/dev-redmine',
}
So I finally got my puppet configuration to work. Manifest site.pp on Master:
node 'puppet' {
rbenv::install{"puppetuser":}
rbenv::compile{"1.9.3-p374":
user => "puppetuser",
global=>true,
require => Rbenv::Install["puppetuser"]
}
}
Immediately after installation I ran "rbenv shims" and was quite suprised to not find bundler in the list although everything else worked as expected:
puppetuser@puppet:~$ rbenv shims
/home/puppetuser/.rbenv/shims/erb
/home/puppetuser/.rbenv/shims/gem
/home/puppetuser/.rbenv/shims/irb
/home/puppetuser/.rbenv/shims/rake
/home/puppetuser/.rbenv/shims/rdoc
/home/puppetuser/.rbenv/shims/ri
/home/puppetuser/.rbenv/shims/ruby
/home/puppetuser/.rbenv/shims/testrb
puppetuser@puppet:~$ rbenv versions
system
* 1.9.3-p374 (set by /home/puppetuser/.rbenv/version)
puppetuser@puppet:~$ ruby -v
ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]
puppetuser@puppet:~$
When I added this to my manifest:
rbenv::gem{"bundler":
user=>"puppetuser",
ruby=>"1.9.3-p374"
}
all hell broke loose:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Rbenvgem[puppetuser/1.9.3-p374/bundler/present] is already declared in file /etc/puppet/modules/rbenv/manifests/gem.pp at line 28; cannot redeclare at /etc/puppet/modules/rbenv/manifests/gem.pp:28 on node puppet
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
Which should mean that bundler is installed, right? But Gem has a different opinion:
puppetuser@puppet:~$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.4)
What is that? What should I do?
_UPDATE_: for the sake of experiment I added another version of ruby:
rbenv::compile{"2.0.0-rc2":
user=>"puppetuser",
require=>Rbenv::Install["puppetuser"]
}
And bundler didn't get installed either:
puppetuser@puppet:~$ sudo puppet agent -t --server=puppetmaster
info: Caching catalog for puppet
info: Applying configuration version '1360662742'
notice: /Stage[main]//Node[puppet]/Rbenv::Compile[2.0.0-rc2]/Exec[rbenv::compile puppetuser 2.0.0-rc2]/returns: executed successfully
notice: /Stage[main]//Node[puppet]/Rbenv::Compile[2.0.0-rc2]/Exec[rbenv::rehash puppetuser 2.0.0-rc2]/returns: executed successfully
notice: Finished catalog run in 571.99 seconds
Your thoughts here ... :)
I am new to puppet so bear with me...
I was very happy to use your module. It worked perfectly except that it did not preserve my PATH. Instead, what I find in my PATH variable after the rbenv paths is just a generic "/bin:/usr/bin:/usr/sbin" and not my previous paths as expected.
I traced this to my .bashrc where I found:
export PATH=/home/vagrant/.rbenv/bin:/bin:/usr/bin:/usr/sbin
Where I expected something like:
export PATH=/home/vagrant/.rbenv/bin:$PATH
Looking in the module I found in manifests/install.pp:30 inside an exec statement:
command => "echo \"export PATH=${root_dir}/${install_dir}/bin:\$PATH\" >> .bashrc",
Now this looks right, but I think that $PATH may be being evaluated before it is written to the .bashrc file. At least that is what appears to be happening.
This is the best I can do at this time as I have not yet learned any puppet debugging techniques.
WORKAROUND:
For now I am simply modifying export PATH in my .bashrc to the following:
export PATH=/home/vagrant/.rbenv/bin:$PATH
Thanks for publishing this module. It saved me a lot of time and taught me a few things as well!
I am not sure if this is an issue or not. My limited understanding has led me to think that nothing should be executed if the machine is up to date...
I am calling the rbenv module in this manner:
class { rbenv:
user => 'vagrant',
compile => true,
version => '1.9.3-p194',
}
When I run puppet apply --verbose --modulepath modules manifests/site.pp
I see the following:
notice: /Stage[main]/Rbenv/Rbenv::Compile[rbenv::compile::vagrant::1.9.3-p194]/Exec[rehash-rbenv vagrant]/returns: executed successfully
If this is intentional, my apologies.
When I provision my vagrant VM with...
$ruby = '1.9.3-p125'
rbenv::install { 'vagrant':
rc => '.bashrc',
}
rbenv::compile { "vagrant/${ruby}":
user => 'vagrant',
ruby => $ruby,
global => true,
}
...then Puppet pukes on the carpet:
err: /Stage[main]/Base/Rbenv::Compile[vagrant/1.9.3-p125]/File[rbenv::global vagrant]/ensure: change
from absent to file failed: Could not set 'file on ensure: No such file or directory -
/home/vagrant/.rbenv/version.puppettmp_965 at /tmp/vagrant-puppet/modules0/rbenv/manifests/compile.pp:98
Requiring Rbenv::Install['vagrant']
inside rbenv::compile
solves the problem, but I feel that this dependency should be better handled inside the module.
When trying to use the module on my node, it spits out this error, and thus fails to install:
err: /Stage[main]//Node[default]/Rbenv::Install[vagrant]/Exec[rbenv::checkout vagrant]/returns: change from notrun to 0 failed: git clone git://github.com/sstephenson/rbenv.git /.rbenv returned 128 instead of one of [0] at /tmp/vagrant-puppet/modules-0/rbenv/manifests/install.pp:24
Any ideas/suggestions? :)
I'm experiencing an issue with my Puppetmaster, where "puppet master" breaks on rbenv rubies installed with puppet-rbenv, but functions correctly on the system Ruby.
Experienced on Ubuntu 12.04. rbenv installed under "deployer" user. Behavior does not change by using different Rubies or different versions of Puppet.
Example:
# rbenv shell 1.8.7-p370
# which puppet
/home/deployer/.rbenv/shims/puppet
# gem list
... snipped unrelated gems...
facter (1.6.14)
puppet (2.7.19)
# puppet master
/home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- puppet/network/server (LoadError)
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application/master.rb:191:in `main'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application/master.rb:146:in `run_command'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `run'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application.rb:416:in `hook'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `run'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application.rb:407:in `exit_on_fail'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `run'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/lib/puppet/util/command_line.rb:69:in `execute'
from /home/deployer/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/puppet-2.7.19/bin/puppet:4
from /home/deployer/.rbenv/versions/1.8.7-p370/bin/puppet:19:in `load'
from /home/deployer/.rbenv/versions/1.8.7-p370/bin/puppet:19
# rbenv shell 1.9.3-p286
# which puppet
/home/deployer/.rbenv/shims/puppet
# gem list
... snipped unrelated gems...
facter (1.6.14)
puppet (2.7.19)
# puppet master
/home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
/home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- puppet/network/server (LoadError)
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application/master.rb:191:in `main'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application/master.rb:146:in `run_command'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `block (2 levels) in run'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application.rb:416:in `hook'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `block in run'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application.rb:407:in `exit_on_fail'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/application.rb:309:in `run'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/lib/puppet/util/command_line.rb:69:in `execute'
from /home/deployer/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/puppet-2.7.19/bin/puppet:4:in `<top (required)>'
from /home/deployer/.rbenv/versions/1.9.3-p286/bin/puppet:23:in `load'
from /home/deployer/.rbenv/versions/1.9.3-p286/bin/puppet:23:in `<main>'
# rbenv shell system
# which puppet
/home/deployer/.rbenv/shims/puppet
# gem list
... still snipping unrelated gems...
facter (1.6.14)
puppet (2.7.19)
# puppet master
# (returns to prompt, no error messages)
# ps ax | grep puppet
19766 ? Ssl 0:00 /usr/bin/ruby1.8 /usr/local/bin/puppet master
And from that final point, puppet master works - clients connect and everything runs as expected.
So far, "puppet master" is the only thing I've seen this breakage in. Not certain the issue is puppet-rbenv, but it's the only common element so far. And if it's not puppet-rbenv, I'd be eternally grateful for some sort of clue as to what might cause this behavior.
Provide installation for zsh shell. This can be handled through a define parameter.
When I run rbenv::compile
after rbenv is installed, but before any rubies are compiled in it, I get this non-fatal error:
err: /Stage[main]//Rbenv::Compile[1.9.3-p194]/Rbenv::Gem[rbenv::bundler deploy 1.9.3-p194]/Rbenvgem[deploy/1.9.3-p194/bundler]:
Could not evaluate: Execution of '/bin/su - deploy -c /home/deploy/.rbenv/versions/1.9.3-p194/bin/gem list --local bundler$'
returned 127: zsh:1: no such file or directory: /home/deploy/.rbenv/versions/1.9.3-p194/bin/gem
.rbenv/versions/1.9.3-p194/bin/gem
doesn't exist because 1.9.3-p194 hasn't been compiled yet! Puppet proceeds after this error to compile the ruby, and running puppet for the 2nd time doesn't yield this error anymore.
It seems like Rbenv::Gem should have a dependency on Rbenv::Compile for that particular version?
rbenv::compile has a variable $default
set to false
. If true, it sets the current version as "global" version in rbenv.
I want to set it to true, but I don't now how in Puppet. These are all syntax errors:
rbenv::compile { '1.9.3-p125':
default => true,
'default' => true,
$default => true
}
Because default
seems to be a reserved keyword in Puppet for use in ternary and case statements.
This is just a heads up that if this gets merged in, we might as well create the cache folder by default and save some bandwidth ;-)
Installing rbenv with:
rbenv::install { $user:
require => User[$user],
rc => '.bashrc',
}
...works not for non-login shells:
deployer@precise32:~$ which ruby
/home/deployer/.rbenv/shims/ruby
deployer@precise32:~$ exit
logout
Connection to 127.0.0.1 closed.
$ ssh [email protected] -p 2222
which ruby
$ echo $?
1
...because .bashrc does only source .rbenvrc for interactive shells:
deployer@precise32:~$ egrep -A 1 '(interactive|rbenv)' .bashrc
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
--
source /home/deployer/.rbenvrc
Placing the source statement earlier would of course solve this.
When you install this module via puppet module install alub/rbenv
you're actually getting something different — it declares the rbenvgem type and doesn't include any manifests. So things like rbenv::install aren't found (you'll see errors like Invalid resource type rbenv::install
). See the forge page for reference.
Cloning this Git repo worked fine for me though. Perhaps you could update/pull the forge reference as I'm sure it will confuse lots of people
FYI & in case of future googlers: I had the task:
package { 'git-core' :
ensure => present,
}
which seemed to conflict with this line in ubuntu.pp. I resolved it by changing my Git package to
package { 'git' :
name => 'git-core',
ensure => present,
}
I've just ran into this guy today and haven't seen anything about it on the README, I'll give a shot at using it later on and contribute back some documentation if you dont have the time to do it.
It would be great if modules upports ruby-build keep feature. This would allow to install debugger gems later.
It should be possible to permit multiple installations for different users. This may indicate the need of a define instead of class for the base element.
This is a great project. Thank you for sharing.
When new rubies come out (like 2.0.0-p353), it would be nice to be able to just add the ruby name like 2.0.0-p353
and have your module re-clone git://github.com/sstephenson/rbenv.git
. Right now, it complains that 2.0.0-p353
doesn't exist in ~/.rbenv/plugins/ruby-build/share/ruby-build
, but that would be solved if the repo were re-cloned.
Is there a way to force this to re-evaluate? Or could the schedule
metaparameter solve this?
http://docs.puppetlabs.com/references/latest/metaparameter.html#schedule
The manifest defines the following packages:
$packages = [
rbenv,
ruby-build,
]
package { $packages: ensure => installed, }
While ruby-build
may be available in Debian, it is not available in Ubuntu 12.04.2 LTS, and will not install correctly. Short of an exec to clone the ruby-build repository, I'm not sure what the correct answer is, but relying on the package being installed will obviously not work as intended.
It would be great to release and upload a new version to Forge. Otherwise, we're forced to use git source in librarian which has some problems.
vagrant@dbm:/vagrant$ puppet module install alup-rbenv --modulepath=/vagrant/modules/ Notice: Preparing to install into /vagrant/modules ... Notice: Downloading from https://forge.puppetlabs.com ... Notice: Installing -- do not interrupt ... Error: No such file or directory - /vagrant/modules/rbenv/spec/fixtures/modules/rbenv/manifests Error: Try 'puppet help module install' for usage
This is using puppet 3.2.4 in Ubuntu 13.10.
I'm running CentOS 5.8. Ruby 1.8.7 and puppet 2.7.12.
class { "rbenv":
user => "root",
compile => true,
version => "1.9.3-p125",
}
Error Log: Could not retrieve catalog from remote server: Error 400 on SERVER: Cannot reassign variable home_dir at /etc/puppet/modules/rbenv/manifests/install.pp:6
It appears the Forge version is well behind HEAD, and missing some valuable improvements. Can you update so puppet-module install alup/puppet-rbenv
gets a good copy?
Allow someone to pass a group along with the user so they can use groups like 'staff' etc.
I tried to use puppet-rbenv on a vagrant-created ubuntu guest. my manifest looks like
rbenv::install {'deployer':
group => 'users',
home => "/home/deployer",
}
rbenv::compile {'1.9.3-p194':
user => 'deployer',
home => "/home/deployer",
}
When I ran puppet, I got:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rbenvgem at /etc/puppet/modules/rbenv/manifests/gem.pp:27 on node web.example.com
It seemed to fail in the rbenv::compile
, since it went to completion when I commented out the rbenv::compile
. Could someone tell me the proper way to use rbenv::compile
?
you must include license text for MIT license
After you use this module for the very first time, you cannot upgrade the ruby version because the ruby versiones doesn't upgrade.
After you upgrade the rbenv definitions it works like sharm.
Well it seems I have the same problem as in #41:
puppet: 2.7.19-1puppetlabs2
Ubuntu 10.10 x86_64
rbenv::install { "root":
group => 'root',
home => '/tmp/rubytest'
}
rbenv::compile { "1.9.3-p194":
user => "root",
home => "/tmp/rubytest",
}
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter ruby at /etc/puppet/modules/rbenv/manifests/gem.pp:28
This is for version cloned straight from git repo and also when I do "puppet module install/upgrade alup-rbenv"
For version "alup-rbenv (v1.0.0)" things seems to be fairly ok, any ideas?
When I try to provision puppet-rbenv with vagrant as specified in the readme I get this issue:
err: /File[/etc/puppet/modules:/tmp/vagrant-puppet/modules-0/rbenv/lib]/ensure: change from absent to directory failed: Cannot create /etc/puppet/modules:/tmp/vagrant-puppet/modules-0/rbenv/lib; parent directory /etc/puppet/modules:/tmp/vagrant-puppet/modules-0/rbenv does not exist
Got 1 failure(s) while initializing: change from absent to directory failed: Cannot create /etc/puppet/modules:/tmp/vagrant-puppet/modules-0/rbenv/lib; parent directory /etc/puppet/modules:/tmp/vagrant-puppet/modules-0/rbenv does not exist
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cd /tmp/vagrant-puppet/manifests && puppet apply --libdir=$modulepath/rbenv/lib --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' site.pp --detailed-exitcodes || [ $? -eq 2 ]
Hello.
How i can compile ruby with patch https://gist.github.com/fivetanley/4646193 - hi is very fast + add CFLAGS="-march=native -Os" and will be very cool if add some variable:
export RUBY_GC_MALLOC_LIMIT=60000000
export RUBY_FREE_MIN=200000
please help me add this all if ruby version 1.9.3-p392 in puppet.
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rbenvgem at /etc/puppet/staging/modules/rbenv/manifests/gem.pp:28 on node sydgsstagserv4.frontfoot.net.au
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
In my site.pp
rbenv::gem { "unicorn":
user => 'www',
ruby => '1.9.3-p327',
gem => 'bundler',
}
My OS version CentOS5.8 x86_64
Puppet version : 2.7.6
We tried to install a Jruby version and got a weird message form a CDN.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>C659D6CCA36E570B</RequestId>
<HostId>
dFRcF6JrIPuJKFPwZ/DRjx/p+zpmpvnqOc1Vb6dC4zv5lM3vjdUwL07N8QchsAeZFUxw671Cjlw=
</HostId>
</Error>
We thought, "no problem", the module allows us to define a source. So we tried doing http using the link defined in the Ruby Build repos.
We ran puppet again and ran into an issue with the exec that run wget. The wget command isn't fully qualified and the path isn't set. Feels like a bug, but we may be missing something. Can someone take a look?
DEBUG [b9bae21f] �[1;31mError: Validation of Exec[rbenv::definition-file sonar jruby-1.7.11] failed: 'wget https://s3.amazonaws.com/jruby.org/downloads/1.7.11/jruby-bin-1.7.11.tar.gz -O /home/sonar/.rbenv/plugins/ruby-build/share/ruby-build/jruby-1.7.11' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppet/modules/rbenv/manifests/definition.pp:29
The onlyif
test to make sure that the the plugin git repo is updated is broken. This was introduced in #108
==> default: Debug: Exec[rbenv::plugin::update vagrant ruby-build](provider=posix): Executing check 'git remote update; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then return 0; else return 1; fi ]'
==> default: Debug: Executing 'git remote update; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then return 0; else return 1; fi ]'
==> default: Debug: /Stage[main]/Devops/Devops::Ruby[devops_ruby]/Rbenv::Compile[1.9.3-p547]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/Exec[rbenv::plugin::update vagrant ruby-build]/onlyif: sh: -c: line 0: syntax error near unexpected token `]'
should be something more like this:
test `git remote update 1> /dev/null; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then echo 0; else echo 1; fi` -eq 1
There should be an option for the user to choose system level (shared) installation ( https://github.com/sstephenson/rbenv/wiki/shared-install-of-rbenv )
When using additional rbenv plugins, they always get updated with "git pull", this causes a puppet change even if there are no updates to the plugins. Plugin updates should only trigger a puppet change when git pull actually does something. Here's the pull request to fix this: #108
Example:
exec {
'install-passenger':
command => 'passenger-install-apache2-module --auto',
path => "${deploy_home}/.rbenv/bin:${deploy_home}/.rbenv/versions/${ruby_version}/bin:/bin:/usr/bin",
user => 'root',
}
Could be written as:
rbenv::exec {
'install-passenger':
command => 'passenger-install-apache2-module --auto',
ruby => $ruby_version,
user => 'root'
rbenv_root => "${deploy_home}/.rbenv"
}
It'd probably be more portable and practical if this was converted into a Puppet module.
I wanted to make sure my deploy user is ready to log in the machine and run gem executables without having to remember to run rbenv rehash
whenever a new gem gets installed from puppet
Could you please tag on github the released version on the forge ?
Running
rbenv::install { $owner:
user => $owner,
group => $group,
rc => '.bashrc',
}
produces the following output form the terminal
ruby -v
# ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
rbenv global
#2.1.2
If I specifically run eval "$(rbenv init -)"
, the correct ruby version is set.
eval "$(rbenv init -)"
ruby -v
# ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Since updating to the latest version of puppet-rbenv, my runs all error with:
Invalid parameter ruby at /etc/puppet/modules/rbenv/manifests/gem.pp:28
My current workaround is to revert to the Sept 20 commit c33eca8, and my runs begin functioning again.
[root@puppet modules]# puppet module install alup-rbenv --environment production
Notice: Preparing to install into /etc/puppet/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Warning: Symlinks in modules are unsupported. Please investigate symlink alup-rbenv-1.2.0/spec/fixtures/modules/rbenv/templates->../../../../templates.
Warning: Symlinks in modules are unsupported. Please investigate symlink alup-rbenv-1.2.0/spec/fixtures/modules/rbenv/manifests->../../../../manifests.
Notice: Installing -- do not interrupt ...
Error: No such file or directory - /etc/puppet/environments/production/modules/rbenv/spec/fixtures/modules/rbenv/templates
Error: Try 'puppet help module install' for usage
Hi,
The readme states that "rbenv rehash is performed each time a new ruby or a new gem is installed.".
I try to make a script which installs ruby then the gem passenger but rbenv rehash is not performed after the installation of the gem... I tried to look at the gem.pp source file and find no indication of a rbenv rehash execution after the gem installation.
Thanks.
It would be nice if puppet-rbenv created the user you assign in rbenv::install if it doesn't exist yet?
There might be a good reason not to do this (i'm fairly new to puppet) so please do tell me if so!
With the simple class below, I am trying to install rbenv, compile 1.9.3-p194 and install unicorn. When I run this, it will install rbenv and download/compile ruby, but it never installs the gem. I am running a clean version of Ubuntu 64 bit 12.04 Desktop (but plan on running against LTS server). I am only using it to setup a puppet catalog for a project I am working on.
class app
{
rbenv::install { "railsuser":
home => '/home/railsuser',
}
rbenv::compile { "railsuser/1.9.3-p194":
user => "railsuser",
home => "/home/railsuser",
ruby => "1.9.3-p194",
global => true,
}
rbenv::gem { "unicorn":
user => "railsuser",
home => "/home/railsuser",
ruby => "1.9.3-p194",
}
}
Output:
info: Applying configuration version '1360541237'
debug: /Stage[main]/Rbenv/Rbenv::Compile[railsuser/1.9.3-p194]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::railsuser]/Rbenv::Plugin[rbenv::plugin::rubybuild::railsuser]/Exec[rbenv::plugin::checkout railsuser ruby-build]/require: requires File[rbenv::plugins railsuser]
debug: /Stage[main]/Rbenv/Rbenv::Compile[railsuser/1.9.3-p194]/Exec[rbenv::compile railsuser 1.9.3-p194]/require: requires Rbenv::Plugin[rbenv::plugin::rubybuild::railsuser]
debug: /Stage[main]/Rbenv/Rbenv::Compile[railsuser/1.9.3-p194]/Exec[rbenv::compile railsuser 1.9.3-p194]/before: requires Exec[rbenv::rehash railsuser 1.9.3-p194]
debug: /Stage[main]/Rbenv/Rbenv::Install[railsuser]/require: requires Class[Rbenv::Dependencies]
debug: /Stage[main]/Rbenv::Dependencies/require: requires Class[Rbenv::Dependencies::Ubuntu]
debug: /Stage[main]/Rbenv/Rbenv::Install[railsuser]/Exec[rbenv::checkout railsuser]/require: requires Package[git]
debug: /Stage[main]/Rbenv/Rbenv::Compile[railsuser/1.9.3-p194]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::railsuser]/Rbenv::Plugin[rbenv::plugin::rubybuild::railsuser]/File[rbenv::plugins railsuser]/require: requires Exec[rbenv::checkout railsuser]
debug: /Stage[main]/Rbenv/Rbenv::Gem[unicorn]/Rbenvgem[railsuser/1.9.3-p194/unicorn/present]/require: requires Exec[rbenv::compile railsuser 1.9.3-p194]
debug: /Stage[main]/Rbenv/Rbenv::Compile[railsuser/1.9.3-p194]/Rbenv::Gem[rbenv::bundler railsuser 1.9.3-p194]/Rbenvgem[railsuser/1.9.3-p194/bundler/present]/require: requires Exec[rbenv::compile railsuser 1.9.3-p194]
debug: /Stage[main]/Rbenv/Rbenv::Install[railsuser]/File[rbenv::rbenvrc railsuser]/require: requires Exec[rbenv::checkout railsuser]
debug: /Stage[main]/Rbenv/Rbenv::Install[railsuser]/Exec[rbenv::shrc railsuser]/require: requires File[rbenv::rbenvrc railsuser]
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Exec[rbenv::shrc railsuser](provider=posix): Executing check 'grep -q rbenvrc /home/railsuser/.profile'
debug: Executing 'grep -q rbenvrc /home/railsuser/.profile'
debug: Exec[rbenv::rehash railsuser 1.9.3-p194](provider=posix): Executing check '[ -e '/home/railsuser/.rbenv/.rehash' ]'
debug: Executing '[ -e '/home/railsuser/.rbenv/.rehash' ]'
debug: Finishing transaction 70018828788080
debug: Storing state
debug: Stored state in 0.01 seconds
notice: Finished catalog run in 0.36 seconds
debug: Executing '/etc/puppet/etckeeper-commit-post'
debug: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (yaml)
debug: report supports formats: b64_zlib_yaml raw yaml; using yaml
Gem list, as railsuser:
*** LOCAL GEMS ***
bigdecimal (1.1.0)
io-console (0.3)
json (1.5.4)
kgio (2.8.0)
minitest (2.5.1)
rack (1.5.2)
raindrops (0.10.0)
rake (0.9.2.2)
rdoc (3.9.4)
Any ideas on what might be happening?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.