grizzthedj / foreman_ipam

Foreman plugin for integration with External IPAM providers
GNU General Public License v3.0
11 stars 8 forks source link

External IPAM Dashboard Error - undefined method `id' for nil:NilClass #23

Open amghmm opened 3 years ago

amghmm commented 3 years ago

Screen Shot 2021-07-27 at 4 07 48 PM Hello,

I am on foreman Version 2.4.1 and RHEL 7.

After installing the foreman_ipam plugin I am getting the following error.

"undefined method `id' for nil:NilClass"

[root@foreman settings.d]# gem list | grep -i ipam foreman_ipam (0.1.0) [root@foreman settings.d]# uname -mrs Linux 3.10.0-1160.31.1.el7.x86_64 x86_64 [root@foreman settings.d]#

grizzthedj commented 3 years ago

It looks like you might not have any Smart Proxies configured for External IPAM. This plugin communicates with your IPAM provider through the Smart Proxy.

If you have not configured an IPAM enabled Smart Proxy, then do the following:

  1. Navigate to your Smart Proxy root directory, and copy config/settings.d/externalipam_netbox.yml.example to config/settings.d/externalipam_netbox.yml and replace the example values with your Netbox URL and API token. If you are using phpIPAM, the do the same steps, but with the externalipam_phpipam.yml.example file instead.
  2. Copy config/settings.d/externalipam.yml.example to config/settings.d/externalipam.yml, and set enabled to true, and use_provider to externalipam_phpipam or externalipam_netbox.
  3. Restart the foreman-proxy service.
  4. In the Foreman UI, navigate to the Smart Proxies list, and click the Smart Proxy that you configured in steps 1 & 2.
  5. Refresh the features. If you see external_ipam in the list returned, then your foreman_ipam plugin should work.
amghmm commented 3 years ago

@grizzthedj Thank you for your reply! I've followed those steps and installed 'smart_proxy_ipam' plugin. But now I am unable to start smart proxy. I am getting these errors:

Aug 10 10:07:27 foreman-dev systemd: Starting Foreman Proxy... Aug 10 10:07:28 foreman-dev smart-proxy: /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/output.rb:13:in strict_err': Gem loading error: cannot load such file -- smart_proxy_ipam (RuntimeError) Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:46:inrescue in block in system_require' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:39:in block in system_require' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:ineach' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in system_require' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:19:inblock in system_require' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in each' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:insystem_require' Aug 10 10:07:28 foreman-dev smart-proxy: from /usr/share/foreman-proxy/lib/bundler_helper.rb:22:in require_groups' Aug 10 10:07:28 foreman-dev smart-proxy: from /usr/share/foreman-proxy/lib/smart_proxy_main.rb:31:in<top (required)>' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in require' Aug 10 10:07:28 foreman-dev smart-proxy: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:inrequire' Aug 10 10:07:28 foreman-dev smart-proxy: from /usr/share/foreman-proxy/bin/smart-proxy:5:in `

' Aug 10 10:07:28 foreman-dev systemd: foreman-proxy.service: main process exited, code=exited, status=1/FAILURE Aug 10 10:07:28 foreman-dev systemd: Failed to start Foreman Proxy. Aug 10 10:07:28 foreman-dev systemd: Unit foreman-proxy.service entered failed state. Aug 10 10:07:28 foreman-dev systemd: foreman-proxy.service failed.

grizzthedj commented 3 years ago

Ensure that you have a file called proxy-directory/bundler.d/Gemfile.local.rb and the contents of this file should be:

gem 'smart_proxy_ipam'

Then restart the foreman-proxy service