Bug 1518865 - require 'rest-client' fails with Gem::LoadError
Summary: require 'rest-client' fails with Gem::LoadError
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Beta 3
: 5.9.0
Assignee: Nick LaMuro
QA Contact: Martin Kourim
URL:
Whiteboard: testathon
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-29 16:35 UTC by ncatling
Modified: 2018-03-13 14:57 UTC (History)
10 users (show)

Fixed In Version: 5.9.0.12
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-06 15:14:05 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description ncatling 2017-11-29 16:35:46 UTC
Description of problem:

require 'rest-client' fails with Gem::LoadError within irb and when executing automate methods but seems to work in Rails.

irb(main):001:0> require 'rest-client'
Gem::LoadError: Could not find 'mime-types' (< 4.0, >= 1.16) among 251 total gem(s)
Checked in 'GEM_PATH=/opt/rh/cfme-gemset:/root/.gem/ruby:/opt/rh/rh-ruby23/root/usr/share/gems:/opt/rh/rh-ruby23/root/usr/local/share/gems', execute `gem env` for more information
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/dependency.rb:319:in `to_specs'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/specification.rb:1438:in `block in activate_dependencies'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/specification.rb:1427:in `each'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/specification.rb:1427:in `activate_dependencies'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/specification.rb:1409:in `activate'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:196:in `rescue in try_activate'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:193:in `try_activate'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:125:in `rescue in require'
	from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:40:in `require'
	from (irb):1
	from /opt/rh/rh-ruby23/root/usr/bin/irb:11:in `<main>'


Version-Release number of selected component (if applicable):
5.9.0.11


How reproducible:


Steps to Reproduce:
1. irb
2.
3.

Actual results:

Error above.


Expected results:


Additional info:

This fails in Automate methods and irb but seems to work in Rails:

[root@ip-172-31-10-85 vmdb]# rails c
Loading production environment (Rails 5.0.6)
irb(main):001:0> require 'rest-client'
=> true

Comment 2 Greg McCullough 2017-11-29 16:48:12 UTC
Madhu - I would suggest checking with Brandon on this since he made changes in this area recently.

Comment 4 Brandon Dunne 2017-11-30 20:43:47 UTC
Ncatling, you need to install the "mime-types" gem on the system.

Comment 5 mkanoor 2017-12-01 18:41:57 UTC
We are working on fixing the build so the user doesn't have to install mime-types gem.

Comment 6 Nick LaMuro 2017-12-04 20:08:59 UTC
https://github.com/ManageIQ/manageiq/pull/16581 along with https://github.com/ManageIQ/manageiq-automation_engine/pull/125 is one proposed solution for the problem.

That said, we are probably going to go with the more simple solution of just installing `mime-types` in the gem directory.  This will not get used when loading the appliance, but then will be available in automation scripts.

Comment 8 CFME Bot 2017-12-04 21:43:09 UTC
New commit detected on ManageIQ/manageiq-appliance-build/master:
https://github.com/ManageIQ/manageiq-appliance-build/commit/631cb490194b0f1e7ef6e97f0523402dbdac2316

commit 631cb490194b0f1e7ef6e97f0523402dbdac2316
Author:     Satoe Imaishi <simaishi>
AuthorDate: Mon Dec 4 11:38:29 2017 -0500
Commit:     Satoe Imaishi <simaishi>
CommitDate: Mon Dec 4 17:07:47 2017 -0500

    Install 'mime-types' outside of bundle, as it's needed to load 'rest-client'
    in irb/automate.  For bundle, we override with local path 'mime-types-redirector'
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1518865

 kickstarts/partials/post/bundler.ks.erb | 4 ++++
 1 file changed, 4 insertions(+)

Comment 9 CFME Bot 2017-12-04 22:33:25 UTC
New commit detected on ManageIQ/manageiq-appliance-build/gaprindashvili:
https://github.com/ManageIQ/manageiq-appliance-build/commit/bb226ab0907912b62723dc4662992ba5dec0a0b5

commit bb226ab0907912b62723dc4662992ba5dec0a0b5
Author:     Jason Frey <fryguy9>
AuthorDate: Mon Dec 4 16:39:03 2017 -0500
Commit:     Satoe Imaishi <simaishi>
CommitDate: Mon Dec 4 17:25:39 2017 -0500

    Merge pull request #254 from simaishi/add_mime_types
    
    Install 'mime-types' outside of bundle
    (cherry picked from commit 13c4d92aa883974ec8db92cefe79639cd0935938)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1518865

 kickstarts/partials/post/bundler.ks.erb | 4 ++++
 1 file changed, 4 insertions(+)

Comment 10 Martin Kourim 2018-02-15 07:31:25 UTC
Verified on 5.9.0.20 that require 'rest-client' doesn't fail with Gem::LoadError within irb.


Note You need to log in before you can comment on or make changes to this bug.