Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1535591 - foreman is not able to identify agent environment in puppet 5 and sets it to the default
Summary: foreman is not able to identify agent environment in puppet 5 and sets it to ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-17 17:08 UTC by Ewoud Kohl van Wijngaarden
Modified: 2019-09-26 18:39 UTC (History)
7 users (show)

Fixed In Version: foreman-1.15.6.30-1,foreman-installer-1.15.6.7-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20378 0 Normal Closed foreman is not able to identify agent environment in puppet 5 and sets it to the default 2020-06-08 20:50:49 UTC

Description Ewoud Kohl van Wijngaarden 2018-01-17 17:08:10 UTC
I was having the following issue:
 - the node had the correct environment set in puppet.conf
 - the node was in the right environment in foreman
 - I ran puppet on the node and in foreman it was moved to the default environment

I've noticed that in my setup the /opt/puppetlabs/server/data/puppetserver/yaml/node/$fqdn.yaml is not getting generated (yaml/facts/$fqdn.yaml is there). 
I don't know why it doesn't get generated but it seems that upgrading to puppet 5 that file stopped being written.

As pointed out by gwmngilfen, the above file is used in the classifier script in case the environment is not amongst the facts ( https://github.com/theforeman/puppet-foreman/blob/master/files/external_node_v2.rb#L119-L130 )

Currently the variable `name` which defines the environment is  follows ( https://github.com/theforeman/foreman/blob/develop/app/services/puppet_fact_parser.rb#L64 )
<pre>
    name = facts[:environment] || Setting[:default_puppet_environment]
</pre>

I have disabled "ENC environment" setting (because I want the agent to be able to specify a different env for testing features). So I'm not sure how the behavior should be in case the setting is enabled but a simple workaround for this would be
<pre>
   name = facts[:environment] || facts[:agent_specified_environment] || Setting[:default_puppet_environment]
</pre>

I tested the above on 1.15.2 and it works as expected.

Comment 1 Ewoud Kohl van Wijngaarden 2018-01-17 17:08:18 UTC
Created from redmine issue http://projects.theforeman.org/issues/20378

Comment 2 Ewoud Kohl van Wijngaarden 2018-01-17 17:08:25 UTC
Upstream bug assigned to None

Comment 4 Ewoud Kohl van Wijngaarden 2018-01-17 17:31:33 UTC
Note the original description was copied from the upstream tracker, not something I wrote. The script could do a better job here :)

Including these cherry picks will allow using an external Puppet 5 server with Satellite 6.3. They will not bring full Puppet 5 compatibility since there are 2 known incompatibilities in the installer and there are no Puppet 5 packages built.

Comment 5 Satellite Program 2018-01-17 19:06:59 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20378 has been resolved.

Comment 10 Satellite Program 2018-02-21 16:54:37 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> > 
> > For information on the advisory, and where to find the updated files, follow the link below.
> > 
> > If the solution does not work for you, open a new bug report.
> > 
> > https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.