Project

General

Profile

Actions

Bug #32222

open

Puppet ENC should use valid Puppet variable names

Added by Matt Fields about 3 years ago. Updated about 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 #1

Updated by Ondřej Ezr about 3 years ago

Hi, thanks for reporting this, but Puppet ENC is being moved to plugin, so all feature requests should be open against the plugin.

Actions #2

Updated by Ondřej Ezr about 3 years ago

Hmm OTOH, this is ENC of host parameters, which stays in core.
Do you think it would be a good solution to put both versions of the names in parameters?
There is also ongoing effort to get rid of all dashed parameters and rename them to underscored.

Actions #3

Updated by Ondřej Ezr about 3 years ago

I've opened A GH-129 for plugin

Actions #4

Updated by Matt Fields about 3 years ago

Ondřej Ezr wrote:

Hmm OTOH, this is ENC of host parameters, which stays in core.
Do you think it would be a good solution to put both versions of the names in parameters?
There is also ongoing effort to get rid of all dashed parameters and rename them to underscored.

We have applied a patch to our local foreman instance which adds the underscored version in addition to the dashed version, and it works well in our testing.
This seems like a good solution until all the dashed parameters have been renamed.

Actions

Also available in: Atom PDF