Feature #15972
openForeman fact name used for 'update_environment_from_facts' should be parametrizable
Description
New Puppet Code does not automatically export the "Environment" fact anymore. See http://projects.theforeman.org/issues/2205.
To allow clients to switch environments permanently when using Foreman as ENC and to support reporting the puppet client environment in Foreman dashboard, the ticket suggests adding a custom fact, which works for us.
However puppet has a very bad behaviour in 3.x, as custom facts can overwrite ENC set environment. See https://tickets.puppetlabs.com/browse/PUP-2630 for reference.
Currently the name of the fact used for "update_environment_from_facts" is hard coded to :environment, which causes a lot of side effects caused by the puppet bug above.
To provide reasonable compatibility, Foreman should support a new config option to define the fact name which will be used for "update_environment_from_facts" (e.g. puppet_environment). This way, clients side effects by setting the custom fact "environment" can be avoided while allowing the user who want's to "use update_environment_from_facts", to use this functionality by using another fact name as source for update_environment_from_facts.
The default value can be "environment" to provide 100% backward compatibility.
Files