Problem with installation of "phpIpam" plugin

Hello,

Can you provide me with a proper steps how should I properly install “plugin” in Foreman?
In particular, I would like to install this one → GitHub - grizzthedj/smart_proxy_ipam: Foreman Smart Proxy plugin for integration with External IPA.

Although I followed the steps from how-to (Foreman :: Plugin Manuals) I was not able to install it ( I have Foreman 2.1 installed).

I did the following:

scl enable tfm bash
gem install --ignore-dependencies smart_proxy_ipam
vi ~foreman/bundler.d/Gemfile.local.rb
→ gem ‘smart_proxy_ipam’
foreman-rake bundler install

and got like:

root@foreman:/usr/share/foreman/bundler.d $ foreman-rake bundler install
rake aborted!
NameError: uninitialized constant Proxy::Plugin
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.17/lib/foreman_hooks/as_dependencies_hook.rb:4:in load_missing_constant' /opt/rh/rh-ruby25/root/usr/local/share/gems/gems/smart_proxy_ipam-0.1.4/lib/smart_proxy_ipam/ipam.rb:2:in module:Ipam
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/smart_proxy_ipam-0.1.4/lib/smart_proxy_ipam/ipam.rb:1:in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require’
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/smart_proxy_ipam-0.1.4/lib/smart_proxy_ipam.rb:2:in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:41:in block in system_require' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in each’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in system_require' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:19:in block in system_require’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in each' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in system_require’
/usr/share/foreman/config/application.rb:35:in <top (required)>' /usr/share/foreman/Rakefile:1:in <top (required)>’
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.3/exe/rake:27:in `<top (required)>’

Caused by:
LoadError: cannot load such file – smart_proxy_ipam
/opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in block in require’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:291:in load_dependency' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in require’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:41:in block in system_require' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in each’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in system_require' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:19:in block in system_require’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in each' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in system_require’
/usr/share/foreman/config/application.rb:35:in <top (required)>' /usr/share/foreman/Rakefile:1:in <top (required)>’
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.3/exe/rake:27:in <top (required)>' (See full trace by running task with --trace)e' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:19:in block in system_require’
/opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in each' /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in system_require’
/usr/share/foreman/config/application.rb:35:in <top (required)>' /usr/share/foreman/Rakefile:1:in <top (required)>’
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.3/exe/rake:27:in `<top (required)>’
(See full trace by running task with --trace)

Also tried to run it as a “foreman” user but the outcome was the same.

What am I missing here?

Thanks for help in advance !

@buddyjoe It looks like you are trying to install the plugin in Foreman itself, not the Foreman Proxy. This plugin is for the Foreman Smart Proxy, not Foreman.

Try the same install steps from the foreman-proxy/ directory, not the foreman/ one.

2 Likes

Really wish this would get added to the official plugins repo. As a side note, great work on this grizzthedj.

That means I can install it still on my “main” foreman machine but in the different folder, right? Or should I only install it on some proxy?

And what if I have no proxy, I can’t install it then?

Thanks for answer!

If your “main” Foreman machine is an “all in one” install(i.e. meaning that Foreman and Proxy are installed on the same machine), then yes, the foreman-proxy/ will exist on the same machine.

I believe that Foreman cannot run without at least one Proxy, so you will likely have one setup. I suspect that it will exist on your “main” Foreman machine.

Hope this helps.

Hello,

Sorry for late reply, unfortunately running it from /foreman-proxy didn’t improve the overall situation:

root@foreman:/usr/share/foreman-proxy/bundler.d $ foreman-rake bundler install
rake aborted!
Don't know how to build task 'bundler' (See the list of available tasks with `rake --tasks`)
Did you mean?  bundler:deps
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)



foreman@foreman:/usr/share/foreman-proxy/bundler.d $ foreman-rake bundler install
rake aborted!
Don't know how to build task 'bundler' (See the list of available tasks with `rake --tasks`)
Did you mean?  bundler:deps
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

Am I doing something wrong?

Any chance to get some update here?

Thanks in advance!

Hey, we haven’t productized this plugin yet, it is still in what we call incubation phase. We need help with finishing it and commiting to resolving problems.

@buddyjoe My apologies for the late response. You should be in the foreman-proxy root directory(not bundler.d directory) when installing the gem.

Can you try running bundle install from the /usr/share/foreman-proxy/ directory instead, and post the output?

1 Like