Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this be updated to support Foreman 3.4? #96

Open
mscrnt opened this issue Mar 1, 2023 · 6 comments
Open

Can this be updated to support Foreman 3.4? #96

mscrnt opened this issue Mar 1, 2023 · 6 comments

Comments

@mscrnt
Copy link

mscrnt commented Mar 1, 2023

I've been trying to get this working on a test server that I have Foreman 3.4 w/ katello 4.6 and I keep running into issues when running foreman-rake.

 /usr/sbin/foreman-rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Name has already been taken

I didn't pull from git hub. I used this cmd...
dnf install rubygem-foreman_netbox.noarch

I had to edit foreman's settings.rb to get to that point. Here's what I did...

require 'resolv'

class Setting < ApplicationRecord
  attr_accessor :description, :default, :full_name, :encrypted
...

I would appreciate any help with this. Thanks.

@mscrnt mscrnt changed the title Is this updated to support Foreman 3.4? Can this be updated to support Foreman 3.4? Mar 1, 2023
@kamils-iRonin
Copy link
Collaborator

@mscrnt #98 is merged, can you check if it fixes the issue?

@mscrnt
Copy link
Author

mscrnt commented Mar 9, 2023

@kamils-iRonin Sorry, I don't think I can test the fix in the current state. I've spent a good amount of time today trying to install from github with no joy. I'm just not that experienced with the program yet.

If you are willing to share instruction on how to install from github or publish as a gem, I can test the fix for you.

Really appreciate all the work you are putting into this.

@kamils-iRonin
Copy link
Collaborator

@mscrnt a new version of the gem (1.1.1) has just been released, see https://rubygems.org/gems/foreman_netbox/versions/1.1.1

@mscrnt
Copy link
Author

mscrnt commented Mar 10, 2023

@kamils-iRonin This did not seem to fix the issue. I'm able to install the gem without dependencies, but it doesn't add the tab to the settings page.

When I install w/dependencies, I receive this error...



Fetching openssl-3.1.0.gem
Building native extensions. This could take a while...
ERROR:  Error installing foreman_netbox:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/openssl-3.1.0/ext/openssl
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20230310-51882-76bwlx.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/openssl-3.1.0 for inspection.
Results logged to /usr/local/lib64/gems/ruby/openssl-3.1.0/gem_make.out

This was actually the error I was getting when trying to install from github, so I guess I might have been doing that correctly.

After installing ruby-devel, I get a slightly different error...

gem install foreman_netbox
Building native extensions. This could take a while...
ERROR:  Error installing foreman_netbox:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/openssl-3.1.0/ext/openssl
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20230310-52183-gmestf.rb extconf.rb
checking for rb_io_maybe_wait(0, Qnil, Qnil, Qnil) in ruby/io.h... no
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for openssl/ssl.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
...

extconf.rb:101:in `<main>': OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/lib64/gems/ruby/openssl-3.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/openssl-3.1.0 for inspection.
Results logged to /usr/local/lib64/gems/ruby/openssl-3.1.0/gem_make.out

Hope that helps out. Let me know if you want me to try anything else.

I've also attached my mkmf.log file in case that has any additional info.
mkmf.log

Thanks

@mscrnt
Copy link
Author

mscrnt commented Mar 30, 2023

Ok, I was able to get it running on Foreman 3.5. Not sure If I just don't know foreman well enough or if there is an issue with the plugin.

In order to install it, I needed to...

  1. Install via github
  • gem install specific_install
  • gem specific_install -l https://github.com/dm-drogeriemarkt/foreman_netbox.git
  1. Install via dnf
  • dnf install rubygem-foreman_netbox.noarch
  1. run foreman-rake db:migrate

  2. Restart the Foreman Service

  • foreman-maintain service restart

If I just do one or the other, foreman fails to restart services.

@celldara
Copy link

Having a similar issue, but with Foreman 3.5. We have a need to upgrade to Satellite 6.13, which moves from Foreman 3.3 to 3.5 and have the same issue as mscrnt. We did not attempt his method yet because it fails during satellite-install when doing foreman-rake db:seed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants