Ruby 1.8.7 vs 1.9.3 version errors?

I used the foreman-installer to install foreman, and can not get foreman
1.2 to work properly on Scientific Linux 6 due to what I believe are ruby
versioning issues? I am relatively new to Ruby and setting up a Rails
environment, so to try and resolve my issues after a week of
troubleshooting and searching online, thought I'd come here to ask you all
for help!

Scientific Linux and RHEL 6 do not maintain ruby1.9.3, they only officially
support 1.8.7. So ruby -v returns "ruby 1.8.7 (2011-06-30 patchlevel 352)
[x86_64-linux]".

I operate in a standalone environment, so when looking elsewhere for
ruby193, I mostly looked for yum repos that I can reposync and utilize
without access to the internet. Everything I have found for ruby193,
installs the binary as "ruby193-ruby" and my server still thinks ruby 1.8.7
is the default version.

I believe the ruby versioning is preventing foreman from operating properly
because the rake calls to push data to the DB fails. I cannot import any
environments, or classes, yet the web interface and smart-proxy are working
properly.

Output from my rake command is:
rake puppet:import:puppet_classes --trace RAILS_ENV=production
(in /usr/share/foreman)
rake aborted!
no such file to load – rails/all
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
/usr/share/foreman/config/application.rb:3
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
/usr/share/foreman/Rakefile:1
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2382:in load' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2382:inraw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2015:in load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1999:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1997:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Rakefile content is:
require File.expand_path('…/config/application', FILE)
require 'rake'
include Rake::DSL
SingleTest.load_tasks if defined? SingleTest
Foreman::Application.load_tasks
Though I woudl rather stick with yum, I tried using RVM to change me
version of ruby over to 1.9.3, and was still unsuccessful.

Any help is appreciated!

Hello,

Foreman 1.2 on RHEL6 (and clones) is only supported on Software
Collections. If you don't know what this is, please read this:

https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/1/html/Software_Collections_Guide/

Currently we have our own ruby193 collection which is distributed with
Foreman 1.2 itself. Please follow our standard installation guide for
RHEL6 in this case and everything will work.

If you want to use "rake", you need to use it from within the SCL stack.
To do that do:

cd ~foreman
scl enable ruby193 "rake -T"

That's how you do it now.

LZ

··· On Tue, Jul 30, 2013 at 06:59:51AM -0700, Adam Carlson wrote: > I used the foreman-installer to install foreman, and can not get foreman > 1.2 to work properly on Scientific Linux 6 due to what I believe are ruby > versioning issues? I am relatively new to Ruby and setting up a Rails > environment, so to try and resolve my issues after a week of > troubleshooting and searching online, thought I'd come here to ask you all > for help! > > Scientific Linux and RHEL 6 do not maintain ruby1.9.3, they only officially > support 1.8.7. So ruby -v returns "ruby 1.8.7 (2011-06-30 patchlevel 352) > [x86_64-linux]". > > I operate in a standalone environment, so when looking elsewhere for > ruby193, I mostly looked for yum repos that I can reposync and utilize > without access to the internet. Everything I have found for ruby193, > installs the binary as "ruby193-ruby" and my server still thinks ruby 1.8.7 > is the default version. > > I believe the ruby versioning is preventing foreman from operating properly > because the rake calls to push data to the DB fails. I cannot import any > environments, or classes, yet the web interface and smart-proxy are working > properly. > > > Output from my rake command is: > rake puppet:import:puppet_classes --trace RAILS_ENV=production > (in /usr/share/foreman) > rake aborted! > no such file to load -- rails/all > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in > `gem_original_require' > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' > /usr/share/foreman/config/application.rb:3 > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in > `gem_original_require' > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' > /usr/share/foreman/Rakefile:1 > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2382:in `load' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2382:in > `raw_load_rakefile' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in > `standard_exception_handling' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2015:in `load_rakefile' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1999:in `run' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in > `standard_exception_handling' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1997:in `run' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 > /usr/bin/rake:19:in `load' > /usr/bin/rake:19 > Rakefile content is: > require File.expand_path('../config/application', __FILE__) > require 'rake' > include Rake::DSL > SingleTest.load_tasks if defined? SingleTest > Foreman::Application.load_tasks > Though I woudl rather stick with yum, I tried using RVM to change me > version of ruby over to 1.9.3, and was still unsuccessful. > > Any help is appreciated! > > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out. > >


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Lukas, thanks for the reply.
I have heard of SCL, but have never used it, so thank you for the
references. Looking back at the 1.2 installation guide (I assume there
isn't a specific "RHEL6" one?), I do see the first part that I apparently
missed is below "Upgrade Notes" - which i skipped since I didn't upgrade.
So basically, it's telling me wherever I need to run a "rake" or "ruby"
command as referenced in the guide, I need to run with the scl syntax, or
just refer to the ruby193-* binary. So, when I run the command with the scl
syntax or just referring to ruby193-rake directly, I get the following
error:
[root@fqdn foreman]# scl enable ruby193 "RAILS_ENV=production rake
db:migrate"

OR
[root@fqdn foreman]# ruby193-rake db:migrate RAILS_ENV=production
rake aborted!
FATAL: Ident authentication failed for user "foreman"

··· ** *Tasks: TOP => db:migrate => environment* Any ideas on why I am getting this error if the foreman-installer completes successfully? I appreciate the help! Adam

Dominic, thanks for the reply!

First, to seemingly resolve the Ident authentication failed issue, I added
"host: localhost" to the database.yml file and then when I ran:

*[root@fqdn foreman]# scl enable ruby193 "RAILS_ENV=production rake
db:migrate"

··· * I receieved no output, no errors. Which I guess is good?

Next, when I saw your post, I tried to run with sudo -u and I got:

*[root@fqdn foreman]# cd ~foreman && sudo -u foreman ruby193-rake
db:migrate RAILS_ENV=production
*Sorry, user is not allowed to execute ‘/usr/bin/ruby193-rake
db:migrate RAILS_ENV=production’ as foreman on fqdn.

It basically fails for anyone when I try to run this way… I have some
sudo rules in addition to the foreman proxy one , but I don’t see why that
would prevent me. So I then just ran it with some su trickery, and it
was by far the messiest:

*[root@fqdn foreman]# su - foreman -s /bin/bash -c ruby193-rake db:migrate
RAILS_ENV=production
*rake aborted!
Please install the sqlite3 adapter: gem install activerecord-sqlite3-adapter (Could not find sqlite3 (~> 1.3.5) amongst
[actionmailer-3.2.8, actionpack-3.2.8, activemodel-3.2.8,
activerecord-3.2.8, activeresource-3.2.8, activesupport-3.2.8,
ancestry-1.3.0, apipie-rails-0.0.18, arel-3.0.2, audited-3.0.0,
audited-activerecord-3.0.0, bigdecimal-1.1.0, builder-3.0.0, bundler-1.1.4,
bundler_ext-0.3.0, coffee-rails-3.2.2, coffee-script-2.2.0,
coffee-script-source-1.3.3, daemon_controller-1.1.4, daemons-1.1.4,
diff-lcs-1.1.3, erubis-2.7.0, eventmachine-0.12.10, execjs-1.4.0,
fast_gettext-0.5.10, gettext_i18n_rails-0.9.4, gettext_i18n_rails_js-0.0.8,
hike-1.2.1, i18n-0.6.0, i18n_data-0.2.7, io-console-0.3, journey-1.0.4,
jquery-rails-2.0.2, jquery-ui-rails-4.0.2, json-1.5.4, mail-2.4.4,
mime-types-1.19, multi_json-1.3.6, net-http-persistent-2.7, net-ldap-0.2.2,
oauth-0.4.7, passenger-4.0.5, pg-0.12.2, po_to_json-0.0.7, polyglot-0.3.3,
rabl-0.7.6, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1,
rails-3.2.8, railties-3.2.8, rake-0.9.2.2, rdoc-3.12, ref-1.0.0,
rest-client-1.6.1, ruby2ruby-2.0.1, ruby_parser-3.1.1, safemode-1.2.0,
sass-3.1.20, sass-rails-3.2.5, scoped_search-2.5.1, sexp_processor-4.1.3,
sprockets-2.4.5, therubyracer-0.11.0beta5, thin-1.3.1, thor-0.15.4,
tilt-1.3.3, treetop-1.4.10, twitter-bootstrap-rails-2.2.6, tzinfo-0.3.33,
uglifier-1.2.6, uuidtools-2.1.3, will_paginate-3.0.2])

*Tasks: TOP => test:units => test:prepare => db:test:prepare =>
db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
*

I thoguht the initial command was successful, but after restarted the
foreman, foreman-proxy, and httpd, I go back to try and load Environments
from Master and I still get the same old “No changes detected” message and
nothing is imported. :frowning:

Any ideas? Thanks again!

On Tuesday, July 30, 2013 11:11:51 AM UTC-4, Dominic Cleal wrote:

On 30/07/13 16:09, Adam Carlson wrote:

Lukas, thanks for the reply.
I have heard of SCL, but have never used it, so thank you for the
references. Looking back at the 1.2 installation guide (I assume there
isn’t a specific “RHEL6” one?), I do see the first part that I
apparently missed is below “Upgrade Notes” - which i skipped since I
didn’t upgrade. So basically, it’s telling me wherever I need to run a
"rake" or “ruby” command as referenced in the guide, I need to run with
the scl syntax, or just refer to the ruby193-* binary. So, when I run
the command with the scl syntax or just referring to ruby193-rake
directly, I get the following error:
[root@fqdn foreman]# scl enable ruby193 "RAILS_ENV=production rake
db:migrate"

OR
[root@fqdn foreman]# ruby193-rake db:migrate RAILS_ENV=production
/rake aborted!
FATAL: Ident authentication failed for user “foreman”/
//

You’ll also need to use sudo to run as the ‘foreman’ user, as PostgreSQL
is configured to use ident auth. e.g.

cd ~foreman && sudo -u foreman ruby193-rake db:migrate
RAILS_ENV=production

(all on one line, it wrapped)


Dominic Cleal
Red Hat Engineering

>
> Quick Update… I just ran an import of hosts and facts and it worked.
>> Everything is displayed on page now…
>
>
[root@fqdn foreman]# ruby193-rake puppet:import:hosts_and_facts
RAILS_ENV=production

So why would this rake command work, and the environment/class import not
work? Hmmm…

You'll also need to use sudo to run as the 'foreman' user, as PostgreSQL
is configured to use ident auth. e.g.

cd ~foreman && sudo -u foreman ruby193-rake db:migrate RAILS_ENV=production

(all on one line, it wrapped)

··· On 30/07/13 16:09, Adam Carlson wrote: > Lukas, thanks for the reply. > I have heard of SCL, but have never used it, so thank you for the > references. Looking back at the 1.2 installation guide (I assume there > isn't a specific "RHEL6" one?), I do see the first part that I > apparently missed is below "Upgrade Notes" - which i skipped since I > didn't upgrade. So basically, it's telling me wherever I need to run a > "rake" or "ruby" command as referenced in the guide, I need to run with > the scl syntax, or just refer to the ruby193-* binary. So, when I run > the command with the scl syntax or just referring to ruby193-rake > directly, I get the following error: > *[root@fqdn foreman]# scl enable ruby193 "RAILS_ENV=production rake > db:migrate"* > OR > *[root@fqdn foreman]# ruby193-rake db:migrate RAILS_ENV=production* > /rake aborted! > FATAL: Ident authentication failed for user "foreman"/ > //


Dominic Cleal
Red Hat Engineering

> Dominic, thanks for the reply!
>
> First, to seemingly resolve the Ident authentication failed issue, I
> added "host: localhost" to the database.yml file and then when I ran:
>
> *[root@fqdn foreman]# scl enable ruby193 "RAILS_ENV=production rake
> db:migrate"
> *
> I receieved no output, no errors. Which I guess is good?

Yep, that's a good sign if there are no migrations to be performed (your
database is up to date).

> Next, when I saw your post, I tried to run with sudo -u and I got:
>
> *[root@fqdn foreman]# cd ~foreman && sudo -u foreman ruby193-rake
> db:migrate RAILS_ENV=production
> */Sorry, user <name> is not allowed to execute '/usr/bin/ruby193-rake
> db:migrate RAILS_ENV=production' as foreman on fqdn./
>
> It basically fails for anyone when I try to run this way… I have some
> sudo rules in addition to the foreman proxy one , but I don't see why
> that would prevent me. So I then just ran it with some su trickery,
> and it was by far the messiest:

Curious, maybe your root user doesn't have a sudo rule permitting it to
run commands as other users.

> *[root@fqdn foreman]# su - foreman -s /bin/bash -c ruby193-rake
> db:migrate RAILS_ENV=production

Try quoting the command to -c, e.g.

su - foreman -s /bin/bash -c "ruby193-rake db:migrate RAILS_ENV=production"

I think what's happening is the RAILS_ENV and db:migrate arguments are
getting chopped off the command, so you're getting an error that implies
it's not obeying RAILS_ENV.

··· On 30/07/13 16:38, Adam Carlson wrote:


Dominic Cleal
Red Hat Engineering

Yep, the quotes after -c allowed the command to execute successfully. Good
catch, thank you!

After my host import to foreman, I do have an environment listed, but it
doesnt contain any of my classes. I think it was just added because all of
the hosts are by default in the production environment.

So the rake command works, next step in the manual is to import data from
puppet. For which it says "At this point, you might want to go through the
[[FAQ]] to see how can you import your data into Foreman." That doesn't
really help…

Since I had some hosts and facts uploaded, I thought I would run puppet on
the client to see what happens… and of course, that opened a whole new
can of worms. I get teh following error:

*[root@client ~]# puppet agent --test --verbose --waitforcert=5
*Error: Could not request certificate: Error 403 on SERVER: <!DOCTYPE HTML
PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /production/certificate/ca
on this server.</p>
<hr>
<address>Apache/2.2.15 (Scientific Linux) Server at uxmaster100.jwac.local
Port 8140</address>
</body></html>

I'm having trouble finding exactly where it is trying to access that
path… I am not sure which DocumentRoot is being referred to. And since
there is no "production" folder on my server other than my module path, I
assume the problem is that the directory does not exist. Any ideas?.

··· On Tuesday, July 30, 2013 12:04:44 PM UTC-4, Dominic Cleal wrote:

On 30/07/13 16:38, Adam Carlson wrote:

Dominic, thanks for the reply!

First, to seemingly resolve the Ident authentication failed issue, I
added “host: localhost” to the database.yml file and then when I ran:

*[root@fqdn foreman]# scl enable ruby193 “RAILS_ENV=production rake
db:migrate”
*
I receieved no output, no errors. Which I guess is good?

Yep, that’s a good sign if there are no migrations to be performed (your
database is up to date).

Next, when I saw your post, I tried to run with sudo -u and I got:

*[root@fqdn foreman]# cd ~foreman && sudo -u foreman ruby193-rake
db:migrate RAILS_ENV=production
*/Sorry, user is not allowed to execute ‘/usr/bin/ruby193-rake
db:migrate RAILS_ENV=production’ as foreman on fqdn./

It basically fails for anyone when I try to run this way… I have some
sudo rules in addition to the foreman proxy one , but I don’t see why
that would prevent me. So I then just ran it with some su trickery,
and it was by far the messiest:

Curious, maybe your root user doesn’t have a sudo rule permitting it to
run commands as other users.

*[root@fqdn foreman]# su - foreman -s /bin/bash -c ruby193-rake
db:migrate RAILS_ENV=production

Try quoting the command to -c, e.g.

su - foreman -s /bin/bash -c “ruby193-rake db:migrate
RAILS_ENV=production”

I think what’s happening is the RAILS_ENV and db:migrate arguments are
getting chopped off the command, so you’re getting an error that implies
it’s not obeying RAILS_ENV.


Dominic Cleal
Red Hat Engineering

> Yep, the quotes after -c allowed the command to execute
> successfully. Good catch, thank you!
>
> After my host import to foreman, I do have an environment listed, but it
> doesnt contain any of my classes. I think it was just added because all
> of the hosts are by default in the production environment.

Yes, you can import classes by going to the Puppet Classes page in the
UI and using the import button in the top right.

I'll refer you to my quickstart video which shows the expected workflow
if you've used the Foreman installer:

> So the rake command works, next step in the manual is to import data
> from puppet. For which it says "At this point, you might want to go
> through the [[FAQ]] to see how can you import your data into Foreman."
> That doesn't really help…

Yes, that's unhelpful. It was originally written for people not using
the installer and integrating everything by hand, while we try and force
a particular workflow now of using the ENC script (/etc/puppet/node.rb).
The installer sets all of this up, so no need to worry.

> Since I had some hosts and facts uploaded, I thought I would run puppet
> on the client to see what happens… and of course, that opened a whole
> new can of worms. I get teh following error:
>
> *[root@client ~]# puppet agent --test --verbose --waitforcert=5
> */Error: Could not request certificate: Error 403 on SERVER: <!DOCTYPE
> HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>403 Forbidden</title>
> </head><body>
> <h1>Forbidden</h1>
> <p>You don't have permission to access /production/certificate/ca
> on this server.</p>
> <hr>
> <address>Apache/2.2.15 (Scientific Linux) Server at
> uxmaster100.jwac.local Port 8140</address>
> </body></html>/
> I'm having trouble finding exactly where it is trying to access that
> path… I am not sure which DocumentRoot is being referred to. And
> since there is no "production" folder on my server other than my module
> path, I assume the problem is that the directory does not exist. Any
> ideas?.

It doesn't relate to anything on the filesystem, Puppet is essentially
parsing the path to get the environment (production) and service being
requested (/certificate/ca).

This is very strange though, perhaps check /etc/httpd/conf.d/puppet.conf
is in place and if there are any errors in /var/log/httpd/* indicating
problems with Puppet. It sounds as if the puppetmaster app hasn't
started up.

··· On 30/07/13 18:21, Adam Carlson wrote:


Dominic Cleal
Red Hat Engineering