Skip to content

Instantly share code, notes, and snippets.

@scumola
Created October 5, 2012 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scumola/3841183 to your computer and use it in GitHub Desktop.
Save scumola/3841183 to your computer and use it in GitHub Desktop.
puppet rvm ruby install
Oct 5 17:21:15 qa-bacin-app01 puppet-agent[25933]: Reopening log files
Oct 5 17:21:15 qa-bacin-app01 puppet-agent[25933]: Starting Puppet client version 2.7.6
Oct 5 17:23:11 qa-bacin-app01 puppet-agent[25933]: (/Stage[main]/Bacin/Rvm_system_ruby[ruby-1.9.3-p194]/ensure) created
Oct 5 17:23:13 qa-bacin-app01 puppet-agent[25933]: (/Stage[main]/Bacin/Rvm_gemset[ruby-1.9.3-p194@bacin]/ensure) created
Oct 5 17:23:14 qa-bacin-app01 puppet-agent[25933]: Could not match /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
Oct 5 17:23:14 qa-bacin-app01 puppet-agent[25933]: Could not match It seems your ruby installation is missing psych (for YAML output).
Oct 5 17:23:14 qa-bacin-app01 puppet-agent[25933]: Could not match To eliminate this warning, please install libyaml and reinstall your ruby.
Oct 5 17:23:18 qa-bacin-app01 puppet-agent[25933]: Could not match /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
Oct 5 17:23:18 qa-bacin-app01 puppet-agent[25933]: Could not match It seems your ruby installation is missing psych (for YAML output).
Oct 5 17:23:18 qa-bacin-app01 puppet-agent[25933]: Could not match To eliminate this warning, please install libyaml and reinstall your ruby.
Oct 5 17:23:18 qa-bacin-app01 puppet-agent[25933]: (/Stage[main]/Bacin/Rvm_gem[ruby-1.9.3-p194@bacin/bundler]/ensure) ensure changed '1.2.1' to '1.2.0'
Oct 5 17:23:18 qa-bacin-app01 puppet-agent[25933]: (/Stage[main]/Newrelic-monitor/Exec[newrelic-package]/returns) executed successfully
Oct 5 17:23:19 qa-bacin-app01 puppet-agent[25933]: Finished catalog run in 121.41 seconds
[root@qa-bacin-app01 ~]# rpm -qa | grep libyaml
libyaml-0.1.2-3.el5
libyaml-0.1.2-3.el5
libyaml-devel-0.1.2-3.el5
libyaml-devel-0.1.2-3.el5
[root@qa-bacin-app01 ~]#
Puppet::Type.type(:rvm_system_ruby).provide(:rvm) do
desc "Ruby RVM support."
commands :rvmcmd => "/usr/local/rvm/bin/rvm"
def create
rvmcmd "install", resource[:name], "--disable-binary"
end
def destroy
rvmcmd "uninstall", resource[:name]
end
def exists?
begin
rvmcmd("list", "strings").split("\n").any? do |line|
line =~ Regexp.new(Regexp.escape(resource[:name]))
end
rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Could not list RVMs: #{detail}"
end
end
def default_use
begin
rvmcmd("list", "default", "string").split("\n").any? do |line|
line =~ Regexp.new(Regexp.escape(resource[:name]))
end
rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Could not list default RVM: #{detail}"
end
end
def default_use=(value)
rvmcmd "--default", "use", resource[:name] if value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment