Hi All,
I know this has been discussed before in the thread "Install foreman
plugins on RPM based installation" but that was resolved back in 2013. I'm
new to ruby and foreman so I couldn't quite follow the ins and outs of that
resolution. So I thought I'd better re-ask in a new thread.
I'm trying to follow the steps outlined in:
http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#RPM-installations
I've managed to install what I suppose is a development instance of foreman
from the git branch 1.12-stable and successfully added my plugin to the
foreman instance. It adds the extra menus and appears on the About page.
I then built my gem as instructed with:
*gem build my_foreman_plugin.gemspec *
which gave me a my_foreman_plugin-0.0.1.gem… all good! My first ever gem.
It's the next step that's causing me dramas…
I hop on to the "production" machine I've been asked to use for my plugin
testing (it's running 1.12), I copy the my_foreman_plugin-0.0.1.gem across,
but the server doesn't have an "scl ruby193" software collection however,
it does have the following collections:
[root@fman-vgrnt-01 ~]# scl --list
rh-ruby22
sclo-ror42
tfm
So I gave the following a whirl and it seemed to be happy (strange that the
tfm software collection seems to install into the rh-ruby22 software
collection):
[root@cpos-fman-vgrnt-01 vagrant]# scl enable tfm "gem install --verbose
–ignore-dependencies foreman_my_plugin-0.0.1.gem"
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/LICENSE
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/README.md
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/Rakefile
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/controllers/foreman_my_plugin/hosts_controller.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/helpers/concerns/foreman_my_plugin/hosts_helper_extensions.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/models/concerns/foreman_my_plugin/host_extensions.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/overrides/dashboard/index/sample_override.html.erb.deface
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/views/dashboard/_foreman_my_plugin_widget.html.erb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/views/foreman_my_plugin/hosts/hosts/new_action.html.erb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/views/foreman_my_plugin/hosts/new_action.html.erb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/views/foreman_my_plugin/layouts/layouts/new_layout.html.erb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/views/foreman_my_plugin/layouts/new_layout.html.erb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/config/routes.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/lib/foreman_my_plugin.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/lib/foreman_my_plugin/engine.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/lib/foreman_my_plugin/version.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/lib/tasks/foreman_my_plugin_tasks.rake
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/locale/Makefile
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/locale/en/foreman_my_plugin.po
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/locale/foreman_my_plugin.pot
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/locale/gemspec.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/test/factories/foreman_my_plugin_factories.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/test/test_plugin_helper.rb
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/test/unit/foreman_my_plugin_test.rb
Successfully installed foreman_my_plugin-0.0.1
Parsing documentation for foreman_my_plugin-0.0.1
Parsing sources…
100% [ 4/ 4] lib/tasks/foreman_my_plugin_tasks.rake
Done installing documentation for foreman_my_plugin after 0 seconds
1 gem installed
However, when I restart the apache server, I'm told the plugin's dependency
on the deface gem is a problem:
Web application could not be started
Gem loading error: Could not find 'deface' (>= 0) among 91 total gem(s)
Checked in
'GEM_PATH=/opt/theforeman/tfm/root/usr/share/gems:/opt/rh/sclo-ror42/root/usr/share/gems:/cpos-local/usr/share/foreman/.gem/ruby:/opt/rh/rh-ruby22/root/usr/share/gems:/opt/rh/rh-ruby22/root/usr/local/share/gems/opt/rh/sclo-ror42/root/usr/share/gems:/opt/rh/rh-ruby22/root/usr/local/share/gems',
execute gem env
for more information (RuntimeError)
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:30:in
`strict_error'
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:56:in
`rescue in block in system_require'
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:37:in
`block in system_require'
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in
`each'
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in
system_require' /cpos-local/usr/share/foreman/config/application.rb:16:in
<top
(required)>'
/opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in
`require'
/opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in
require' /cpos-local/usr/share/foreman/config/environment.rb:2:in
<top
(required)>'
/opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in
`require'
/opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in
require' config.ru:3:in
block in <main>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/builder.rb:55:in
`instance_eval'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/builder.rb:55:in
initialize' config.ru:1:in
new'
config.ru:1:in `<main>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in
`eval'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in
`preload_app'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:150:in
`<module:App>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:29:in
`<module:PhusionPassenger>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:28:in
`<main>'
As I said, I'm new to ruby. I don't quite understand why the instruction
tell me to use "–ignore-dependencies" when installing the gem nor do I
understand why "deface" isn't already installed as a dependency of the
production installation which is already using various plugins and smart
proxies which I assume may require "deface".
I can find no evidence of a deface module already present on the system.
Just the deface view overrides in my own plugin:
[root@cpos-fman-vgrnt-01 vagrant]# locate deface
/home/vagrant/foreman_my_plugin/app/overrides/dashboard/index/sample_override.html.erb.deface
/opt/foreman_my_plugin/app/overrides/dashboard/index/sample_override.html.erb.deface
/opt/rh/rh-ruby22/root/usr/local/share/gems/gems/foreman_my_plugin-0.0.1/app/overrides/dashboard/index/sample_override.html.erb.deface
Any help hugely appreciated…
Cheers,
Doug