Project

General

Profile

Actions

Bug #34965

closed

Foreman Puppet ENC "hostname" and "fqdn" conflict with core Puppet Facts

Added by Paul Donohue almost 2 years ago. Updated over 1 year ago.

Status:
Duplicate
Priority:
High
Assignee:
-
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Per #31168, "hostname" and "fqdn" parameters were added to the Puppet ENC YAML produced by Foreman for use in Ansible:
https://github.com/theforeman/foreman/pull/8103
https://github.com/theforeman/foreman/pull/8134

These parameter names conflict with the names of some "Core Facts" in Puppet:
https://puppet.com/docs/puppet/7/core_facts.html#hostname
https://puppet.com/docs/puppet/7/core_facts.html#fqdn

Unfortunately, this causes a number of problems in Puppet:
  • In some but not all cases, the ENC parameters override the Facts. In addition to being inconsistent, this can break things. For example, see #31882
  • If someone actually wants both the ENC value and the Fact value for some reason (eg. if they want to use the ENC value as the canonical hostname and reconfigure the system if it doesn't match), there is no reliable way in Puppet code to get both or to determine which one actually configured the variable.
  • The ENC parameters cause warning messages in the Puppet logs. For example, see https://community.theforeman.org/t/puppet-the-node-parameter-fqdn-for-node-host-was-already-set-to-host/26543
  • This prevents the ENC parameters from being used through other Puppet interfaces. For example, for Puppet Module development/testing purposes, I have a script that retrieves the ENC output, reformats it as a .pp file that sets variables and declares classes, then runs the .pp file with `puppet apply --test --noop test.pp`. The conflicting name causes this to fail with a "Cannot reassign variable '$hostname'" error.

Can these parameters be renamed?
Renaming the praameters would avoid all of the above issues in Puppet while still achieving the goal of giving Ansible access to these values.

For example, the names could be changed to "foreman_hostname" and "foreman_fqdn" to emulate other existing Foreman-specific parameters (like "foreman_env").
Alternatively, a structured parameter could be used to emulate "Modern" Core Facts in Puppet. In other words, a "foreman" parameter could be created with sub-parameters named "hostname" and "fqdn". (Or maybe call it "foreman_network" to mimic the "network" Core Fact in Puppet, which also contains "hostname" and "fqdn" sub-parameters.)

Actions #1

Updated by Paul Donohue over 1 year ago

  • Status changed from New to Duplicate

I apparently opened this in the wrong redmine project. Replacing this with #35326.

Actions

Also available in: Atom PDF