[PUP-8502] Puppet lookup always includes classes from the ENC Created: 2018/02/28  Updated: 2018/04/09  Resolved: 2018/03/14

Status: Closed
Project: Puppet
Component/s: Hiera & Lookup
Affects Version/s: PUP 4.10.9, PUP 5.3.5
Fix Version/s: PUP 4.10.11, PUP 5.3.6, PUP 5.5.0

Type: Bug Priority: Normal
Reporter: Jarret Lavallee Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template: PUP Bug Template
Acceptance Criteria:

Puppet lookup should not include the catalog unless --compile is specified. 

Sub-team: Language
Team: Platform Core
Sprint: Platform Core KANBAN
Method Found: Customer Feedback
CS Priority: Major
CS Frequency: 3 - 25-50% of Customers
CS Severity: 3 - Serious
CS Business Value: 5 - $$$$$$
CS Impact: Lookup is very helpful but this is one of a number of issues with it related to how it interacts with the PE Node Classifier or other ENCs. A workaround exists as mentioned in this ticket but it's not intuitive and so most customers are likely to put in a support ticket about this.

We should probably document a known issue around this which includes the workaround.
Release Notes: Bug Fix
Release Notes Summary: The lookup CLI tool called the ENC (node terminus) even if {{\--compile}} was not in effect. This could cause errors as classes indicated by the ENC would get loaded without a full and proper setup (could also error if loaded code was had parse errors). Now the configured ENC is only used if {{\--compile}} is in effect.

 Description   

The puppet lookup command evaluates classes that are returned from the ENC when the --compile flag is not specified. This results in failures of the lookup command if the catalog cannot be compiled. 

 

Reproduction Steps 

  1. Install PE or Puppetserver
  2. Create a class like the one below.
  3. Classify a node with the class in the classifier
  4. Run puppet lookup anyhierakey --node <nodename>

A simple class to cause a failure in the lookup is below. 

 

class test (
  String $myparam,
) {
  file {$myparam:
    ensure => absent,
  }
}

Logs

Using the steps above, we see this output from a lookup.

# puppet lookup anything --node pe-201735-agent.puppetdebug.vlan --debug 
...
Debug: importing '/etc/puppetlabs/code/environments/production/modules/test/manifests/init.pp' in environment production
Debug: Automatically imported test from test into production
...
Error: Could not run: Evaluation Error: Error while evaluating a Resource Statement, Class[Test]: expects a value for parameter 'myparam'

Workaround

Add the --node_terminus plain to the command.

# puppet lookup anything --node pe-201735-agent.puppetdebug.vlan --node_terminus plain
--- "test"



 Comments   
Comment by Henrik Lindberg [ 2018/03/05 ]

Merged to 4.10.x at https://github.com/puppetlabs/puppet/commit/6684e904ce814931b3684e2ca36e14139cc9acfb

Generated at Wed Apr 01 14:52:38 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.