Project

General

Profile

Actions

Bug #34837

open

Undefined method `[]` when accessing facts

Added by Oleg Vasiliev almost 2 years ago. Updated 7 months ago.

Status:
Need more information
Priority:
Normal
Assignee:
-
Category:
foreman-installer script
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Env:
- Fresh Ubuntu 20.04.4 (somewhat customized image)
- Foreman 3.2.0-1 from official repos
- Official install guide https://www.theforeman.org/manuals/3.2/quickstart_guide.html

I'm trying to install foreman via foreman-installer. First, it crashes on install and later on any run. Command line arguments isn't parsed (ignores all parameters):

Traceback (most recent call last):
    13: from /usr/sbin/foreman-installer:8:in `<main>'
    12: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:50:in `run'
    11: from /usr/lib/ruby/vendor_ruby/clamp/command.rb:132:in `run'
    10: from /usr/lib/ruby/vendor_ruby/clamp/command.rb:132:in `new'
     9: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:115:in `initialize'
     8: from /usr/lib/ruby/vendor_ruby/kafo/configuration.rb:325:in `run_migrations'
     7: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:35:in `run'
     6: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:35:in `each'
     5: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:38:in `block in run'
     4: from /usr/lib/ruby/vendor_ruby/kafo/migration_context.rb:10:in `execute'
     3: from /usr/lib/ruby/vendor_ruby/kafo/migration_context.rb:10:in `instance_eval'
     2: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:25:in `block (2 levels) in load_migrations'
     1: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:25:in `instance_eval'
/etc/foreman-installer/scenarios.d/foreman.migrations/20200909151007_manage_acls_on_debian.rb:1:in `block (2 levels) in load_migrations': undefined method `[]' for nil:NilClass (NoMethodError)

Then, if I remove or comment file

/etc/foreman-installer/scenarios.d/foreman.migrations/20200909151007_manage_acls_on_debian.rb
foreman-installer starts working but crashes later anyway:

/tmp# foreman-installer
2022-04-26 15:50:14 [NOTICE] [root] Loading installer configuration. This will take some time.
2022-04-26 15:50:25 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2022-04-26 15:50:25 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
Traceback (most recent call last):
    14: from /usr/sbin/foreman-installer:8:in `<main>'
    13: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:50:in `run'
    12: from /usr/lib/ruby/vendor_ruby/clamp/command.rb:132:in `run'
    11: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:180:in `run'
    10: from /usr/lib/ruby/vendor_ruby/clamp/command.rb:63:in `run'
     9: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:199:in `execute'
     8: from /usr/lib/ruby/vendor_ruby/kafo/hooking.rb:65:in `execute'
     7: from /usr/lib/ruby/vendor_ruby/kafo/hooking.rb:65:in `each'
     6: from /usr/lib/ruby/vendor_ruby/kafo/hooking.rb:67:in `block in execute'
     5: from /usr/lib/ruby/vendor_ruby/kafo/hook_context.rb:19:in `execute'
     4: from /usr/lib/ruby/vendor_ruby/kafo/hook_context.rb:19:in `instance_eval'
     3: from /usr/lib/ruby/vendor_ruby/kafo/hooking.rb:36:in `block (4 levels) in load'
     2: from /usr/lib/ruby/vendor_ruby/kafo/hooking.rb:36:in `instance_eval'
     1: from /usr/share/foreman-installer/hooks/pre_validations/30-el7_upgrade_postgresql.rb:26:in `block (4 levels) in load'
/usr/share/foreman-installer/hooks/boot/01-kafo-hook-extensions.rb:93:in `el7?': undefined method `[]' for nil:NilClass (NoMethodError)

Adding `puts facts` to `20200909151007_manage_acls_on_debian.rb` makes me think that `facts` is empty for some reason but facter is present and working normally (strace also shows it working and was run).

What's the problem it could be?

Actions #1

Updated by Ewoud Kohl van Wijngaarden about 1 year ago

Which version of Facter was used? My only thought here is that Facter doesn't have an os fact, though that was introduced in Facter 2.4 IIRC, so a long time ago.

Actions #2

Updated by Ewoud Kohl van Wijngaarden 7 months ago

  • Status changed from New to Need more information
Actions

Also available in: Atom PDF