Project

General

Profile

Bug #27179

foreman-installer 1.22 fails on new Ubuntu Bionic box due to use of upcase() in foreman-proxy's params.pp

Added by Jason C. Hammons about 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Category:
foreman-installer script
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:

1. Install ubuntu-18.04.2-live-server-amd64.iso on a system (in my case a VMWare machine).
2. sudo apt-get update; sudo apt-get upgrade
3. Set static IP address. Reboot for superstitious reasons.
4. Follow https://www.theforeman.org/manuals/1.22/quickstart_guide.html -- entering Ubuntu Bionic into the dropdown to get the relevant repos, et cetera.
5. Run `sudo foreman-installer` and get: "Could not get default values, check log file at /var/log/foreman-installer/foreman.log for more information"
6. Investigate last line of log and see:

      ' | RUBYLIB=/usr/lib/ruby/vendor_ruby/kafo/modules: /opt/puppetlabs/bin/puppet apply --modulepath /usr/share/foreman-installer/modules:/usr/lib/ruby/vendor_ruby/kafo/modules --config=/tmp/kafo_puppet20190627-6383-13r52gs.conf 2>&1
[ERROR 2019-06-27T19:54:19 main] Error: Could not autoload puppet/provider/package/gem: superclass must be a Class (Module given)
Error: Facter: error while resolving custom facts in /usr/share/foreman-installer/modules/stdlib/lib/facter/package_provider.rb: Could not autoload puppet/provider/package/gem: superclass must be a Class (Module given)
Warning: Unknown variable: '::domain'. (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 268, column: 31)
Warning: Unknown variable: '::domain'. (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 299, column: 29)
Error: Evaluation Error: Error while evaluating a Function Call, 'upcase' parameter 'arg' expects a value of type Numeric, String, Array, or Hash, got Undef (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 300, column: 29) on node foreman

[ERROR 2019-06-27T19:54:19 main] Could not get default values, cannot continue

Workaround:

Change $dns_realm = upcase($dns_zone) to $dns_realm = $dns_zone on line 300 of params.pp: https://github.com/theforeman/puppet-foreman_proxy/blob/master/manifests/params.pp#L300

History

#1 Updated by Anonymous about 3 years ago

Warning: Unknown variable: '::domain'. (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 268, column: 31)

The problem here is not the upcase, but the fact that the domain-fact isn't resolved properly, which points to facter. Or does this system have no domain?

#2 Updated by Anonymous about 3 years ago

  • Priority changed from High to Normal

#3 Updated by Jason C. Hammons about 3 years ago

Michael Moll wrote:

[...]
The problem here is not the upcase, but the fact that the domain-fact isn't resolved properly, which points to facter. Or does this system have no domain?

It does and always has:

root@foreman:~# hostname -f
foreman.example.io
root@foreman:~# facter fqdn
foreman.example.io
root@foreman:~# ping foreman.example.io
PING foreman.example.io (192.168.7.57) 56(84) bytes of data.
64 bytes from foreman.example.io (192.168.7.57): icmp_seq=1 ttl=64 time=0.029 ms
64 bytes from foreman.example.io (192.168.7.57): icmp_seq=2 ttl=64 time=0.061 ms
^C
--- foreman.example.io ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1022ms
rtt min/avg/max/mdev = 0.029/0.045/0.061/0.016 ms

I have since downgraded to 1.19 and this issue is not present.

#4 Updated by Anonymous about 3 years ago

What is the output of "facter domain"?

#5 Updated by Jason C. Hammons about 3 years ago

Michael Moll wrote:

What is the output of "facter domain"?

root@foreman:~# facter domain
example.io

#6 Updated by Anonymous about 3 years ago

I'm a bit out of ideas then, however, also the message

[ERROR 2019-06-27T19:54:19 main] Error: Could not autoload puppet/provider/package/gem: superclass must be a Class (Module given)
Error: Facter: error while resolving custom facts in /usr/share/foreman-installer/modules/stdlib/lib/facter/package_provider.rb: Could not autoload puppet/provider/package/gem: superclass must be a Class (Module given)

is pointing to facter/puppet problems...

Is there maybe a OS native package (e.g. "facter"/"puppet" vs. "puppet-agent") installed?

#7 Updated by Anonymous about 3 years ago

Any updates on this?

#8 Updated by Michela Toscano about 3 years ago

Hello! I am getting the same error when following the quick start guide on a fully up to date, fresh installation of CentOS 7.

I have searched the web for information on this issue, but have not found much, apart from this bug report.

foreman-installer with the -i and even --help options produces the same error, pasted below.

[ERROR 2019-07-15T14:21:21 main] ESC[1;33mWarning: Unknown variable: '::domain'. (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 268, column: 31)ESC[0m
ESC[1;33mWarning: Unknown variable: '::domain'. (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 299, column: 29)ESC[0m
ESC[1;31mError: Evaluation Error: Error while evaluating a Function Call, 'upcase' parameter 'arg' expects a value of type Numeric, String, Array, or Hash, got Undef (file: /usr/share/foreman-installer/modules/foreman_proxy/manifests/params.pp, line: 300, column: 29) on node [redacted-host-name]ESC[0m

[ERROR 2019-07-15T14:21:21 main] Could not get default values, cannot continue

#9 Updated by Michela Toscano about 3 years ago

Hi again. I believe I have actually identified the cause of the aforementioned errors (at least in my own situation).

The errors appear if a fully qualified host name is not set via hostnamectl (I am not certain if Debian/Ubuntu use the same mechanism to set host names).

I do not know if the same criteria apply to the reporter of this bug or if my solution will apply to their situation, however in my case, I had a host name set, but it was not a fully qualified one. I set it with hostnamectl set-hostname foreman.example.ca. Then, I started to get more specific error messages related to the host name when I attempted to run the installer again , eventually one of the error messages indicated that reverse DNS look-up was producing different results (localhost), which were not permitted in order to continue installation.

To get the DNS errors to go away, I had to create a DNS record that could be fetched by the DNS resolver set in the machine's resolv.conf file (either a record in public DNS, or one set on my local DNS resolver). If the name was set in /etc/hosts/, the installer would throw an exception and another DNS error message indicating an incorrect result from its reverse-DNS requests.

With that, I suggest that the installer present a more meaningful error to the user in cases where there is a host name set, but it is not a fully qualified one. This would make it possible for the user to work out why the installer is failing to start on their own.

Similarly, it would be helpful if the quick start documentation explained that a FQDN must be set -- and exactly how it must be set -- before starting installation. I also did not see any information specifying how the host names must be set in the full documentation for Foreman either, though I could have missed it.

I hope that is helpful. Please tell me if you would like more information on what I have found, or on my suggested remedy. I can also print this information elsewhere if it would be beneficial to the Foreman developers or community for me to do so.

#10 Updated by Jason C. Hammons about 3 years ago

The errors appear if a fully qualified host name is not set via hostnamectl (I am not certain if Debian/Ubuntu use the same mechanism to set host names).

I had a FQDN, but had set it manually in /etc/hosts and /etc/hostname the old-fashioned way. I was unaware of this newfangled hostnamectl utility which appears to do a lot more. After starting over and using hostnamectl, I cannot reproduce this issue.

Please close this issue. Be well.

#11 Updated by Jason C. Hammons about 3 years ago

  • Assignee set to Jason C. Hammons
  • Status changed from New to Resolved

#12 Updated by Tukusej’s Sirs about 3 years ago

Michela Toscano wrote:

Please tell me if you would like more information on what I have found, or on my suggested remedy. I can also print this information elsewhere if it would be beneficial to the Foreman developers or community for me to do so.

@MichelaToscano, could you please help out a noob with the very same error on CentOS 7? I’ve already change the hostname using `hostnamectl set-hostname foreman.example.com`, however I’ve never created a DNS record. Could you give me a the required commands/steps please?

Thank you in advance.

Edit: Nevermind. I’ve found [this](https://www.tecmint.com/setup-local-dns-using-etc-hosts-file-in-linux/) article that describes the process. Basically, you need to do the following:

1. Change the server IP to a static one. I reserved the IP address in the router and left the server in DHCP mode; one might apply a static address on the server itself.

2. Set a fully qualifed domain name, like foreman.example.com using the hostnamectl set-hostname foreman.example.com command.

3. Edit (append) the /etc/hosts file to redirect the host name of the server (step 2) to its IP (step 1); one can use this command: echo "192.168.1.50 foreman.example.com" > /etc/hosts (of course, change the IP and the hostname).

Also available in: Atom PDF