500 when attempting to provision newly discovered machine

Error message in UI stating: ‘undefined method `puppet’ for nil:NilClass’

Expected outcome:
To be able to provision the discovered asset/vm

Foreman and Proxy versions:
Foreman version:

  • Foreman version: 3.0.0

Proxy versions:

  • Ansible: 3.2.1
  • DHCP: 3.0.0
  • DNS: 3.0.0
  • Dynflow: 0.5.2
  • HTTPBoot: 3.0.0
  • Registration: 3.0.0
  • SSH: 0.4.1
  • TFTP: 3.0.0

Foreman and Proxy plugin versions:
Foreman version:

  • Foreman version: 3.0.0

Plugin versions:

  • foreman-tasks 5.1.0
  • foreman_ansible 6.4.1
  • foreman_dhcp_browser 0.0.8
  • foreman_discovery 18.0.0
  • foreman_openscap 5.0.0
  • foreman_puppet 1.0.1
  • foreman_remote_execution 4.7.0

Distribution and version:
CentOS Linux release 8.4.2105

Other relevant data:
Tangential, but possibly related: After a fresh install of 3.0.0, some hammer commands weren’t working which was addressed by a suggested patch proposed in this thread: Previously working hammer commands return ISE on Fresh 3.0 install. Although, because a new error is now appearing, I deleted my followup reply/findings on that thread and created a new topic here (to keep the noise down over there). I only mention all of this, in the event the two are related.

In a newly installed 3.0.0 env (with the patch applied) attempting to provision a discovered VM fails.

The stack trace complains about missing fields (which are expected because I couldn’t continue to that step in the UI).

Grabbed the log:

[root@foreman ~]# foreman-rake errors:fetch_log request_id=aa1dee76

Here’s the log:

Relevant bits from the pastebin:

2021-09-27T19:30:00 [W|app|aa1dee76] undefined method `puppet' for nil:NilClass
2021-09-27T19:30:00 [I|app|aa1dee76] Backtrace for 'undefined method `puppet' for nil:NilClass' error (ActionView::Template::Error): undefined method `puppet' for nil:NilClass
 aa1dee76 | /usr/share/gems/gems/foreman_puppet-1.0.1/app/views/hosts/_form_puppet_enc_tab.html.erb:3:in `_0429e47b0fd5632dbae334f9be8a72ce'

@ezr-ondrej @nadjaheitmann have you seen this?

I thought this should have been fixed in discovery 18.0.0. Did you restart the foreman service after upgrading the packages?

Is the problem occurring for discovered hosts only?

Reproduced, Puppet 1.0.1 is likely missing a commit.

I tested with Discovery 18.0 and Puppet develop branch and it works, but Puppet 1.0.1 branch does not and I experience the very same issue. @ezr-ondrej there is likely a commit that needs to be backported into Foreman 3.0 version of the puppet plugin.

I tested 18.0 against develop when I was testing it, both via Quick provision and Customize host. I should have done this against 1.0.1, my bad.

Yup, this should be already resolved in 1.0.3, tho we are still on 1.0.1 in Foreman 3.0, the Puppet plugin 1.0.3 got merged into packaging yesterday, I’ll backport those into 3.0, but it will go with Foreman 3.0.1 anyway.

1 Like

FYI you do not need to wait, when something is utterly broken (like in this case) just release it, ask our packaging team to trigger the pipeline.

But if you have some regressions concerns, sure, wait for it.

Hi, thanks for responding. I reboot the entire box after installing and post configs pass.

Thanks @lzap

Just ended up on the same issue with a discovered host.

Thanks to the team for the quick patch!

Foreman 3.0 of Ubuntu 20.04 version of the puppet plugin is still retaining 1.0.0.

On Centos, the latest packages available are foreman 3.0.0 and foreman_puppet 1.0.1.

Foreman_puppet 1.0.3 is available in the nightly repository.

Which is the best approach to patch foreman 3.0.0 with this fix? Wait for foreman 3.0.1 (any idea on when it will be released)? Use the foreman_puppet package from the nightly repository?

We have just merged 1.0.3 puppet plugin into 3.0 branch, the release is near. Just a bit more, sorry about that.

Requested the release: Release pipeline for Foreman Puppet 1.0.3

Many thanks for the update!

Thanks for the quick release of the updated package.

Now I ended up in another issue. Will report it in the right thread (looks like this issue)

Sorry, mea culpa. I had to reboot the foreman master to have the foreman puppet plugin refreshed from 1.0.1 to 1.0.3. And then the customize host problem disappeared.

We are tracking another issue - provisioning of puppet related data will not work over CLI/API. In the meantime, use hostgroups that should work.

Thanks for the notification.

For the server I provisioned yesterday, I used Discovered Hosts → Provision → Customize Host → selected the right hostgroup → and then further customization in the host page.

Actually, I found a bug on the Host Parameters page. When you click on Override, a new empty line is added. If you add multiple overrides, the values (key/value) in the previous ones are cleared. Probably something in the javascript.

Workaround is to add x overrides, and then fill manually all the fields.

Should I report this in a new thread?

Do you see the same if you edit an existing (provisioned) host? If so, file against Foreman core - Hosts. If you only see this for discovery then file it against Discovery Redmine project.