Project

General

Profile

Actions

Bug #32222

open

Puppet ENC should use valid Puppet variable names

Added by Matt Fields over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Currently the Puppet ENC output from Foreman simply takes host parameters as defined, and pushes them into the `parameters` hash without modification.

The Puppet documentation states: "If present, the value of the parameters key must be a hash of valid variable names and associated values".
https://puppet.com/docs/puppet/7.5/nodes_external.html#enc_output_format-section_rbt_2vm_thb

It is currently possible to use dashes in host parameter names, which are then populated into the ENC output; however, variables may not contain dashes in Puppet.
As a result, host parameters containing dashes are not accessible within Puppet.
(Note: they were previously accessible using the `getvar` function in Puppet 5, but this no longer works in Puppet 6+).

While it is possible to work around this issue manually by simply not using dashes in host parameters, there are some dashed host parameters that are used in provisioning templates (such as http-proxy), which are useful in Puppet as well. A current workaround is to define the value twice, once for the templates and one for the ENC value for Puppet, but this is inconvenient and prone to accidental drift.

The Foreman ENC output should convert dashes to underscores for host parameter names containing dashes.

Actions

Also available in: Atom PDF