Unable to provision from Discovery after updating to Foreman 3.0/Katello 4.2

Problem:
Not able to provision from Discovery using GUI or using hammer commands. When using the GUI, after hitting submit, the page goes to blank white page. When using “hammer discovery”, we get “Error: uninitialized constant HammerCLIForeman::CommandExtensions::PuppetEnvironment”
Expected outcome:
New host provisioned on physical servers.
Foreman and Proxy versions:
Foreman 3.0.1-1
Katello 4.2.1
Foreman and Proxy plugin versions:
foreman-tasks 5.1.1
foreman_chef 0.10.0
foreman_discovery 18.0.5
foreman_docker 5.0.0
foreman_puppet 1.0.5
foreman_remote_execution 4.8.0
katello 4.2.1
Distribution and version:
CentOS Linux release 7.9.2009 (Core)
Other relevant data:
hammer discovery
Error: uninitialized constant HammerCLIForeman::CommandExtensions::PuppetEnvironment

I found that by commenting out the line:

extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)

in the file:
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_discovery-1.0.2/lib/hammer_cli_foreman_discovery/discovery.rb

fixed the hammer cli issue.

Hi, @tbrooks, from hammer perspective, there is also a PR that should fix your error [1]. Moreover, if you need Puppet support, you can install hammer-cli-foreman-puppet and apply this patch [1].

[1] - https://github.com/theforeman/hammer-cli-foreman-discovery/pull/51

UPD: Regarding Puppet, this patch will work only for hammer-cli-foreman-puppet version 0.0.5 or above, which wasn’t released yet :confused: But otherwise it should make hammer-cli-foreman-discovery usable again.

2 Likes