The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Feature #2896

`puppet parser validate` does not check resource parameters

Added by Dan Bode over 4 years ago. Updated about 1 year ago.

Status:AcceptedStart date:12/07/2009
Priority:NormalDue date:
Assignee:eric sorenson% Done:

0%

Category:parser
Target version:-
Affected Puppet version:0.25.1 Branch:
Keywords:goalie_06_28_2012 customer

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

puppet --parseonly does not show an error when parsing:

file{'name': bad_owner => 'invalid'}

This should also work for resource definitions.

my_def($param_a='_UNSET_') {} 

my_def{ 
  'my_def_1': 
  pram_a => 'foo'; 
} 

Related issues

Duplicated by Puppet - Bug #3515: parseonly failure on user attribute Duplicate 04/07/2010

History

#1 Updated by James Turnbull over 4 years ago

  • Category set to parser
  • Status changed from Unreviewed to Accepted

#2 Updated by Luke Kanies about 4 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Assignee set to Dan Bode

Dan – I think this actually already works this way in the current testing branch, because of the changes I made to the AST classes.

Once Markus gets a new branch pushed, can you test this?

#3 Updated by Markus Roberts about 4 years ago

  • Status changed from In Topic Branch Pending Review to Investigating

#4 Updated by James Turnbull almost 4 years ago

  • Status changed from Investigating to In Topic Branch Pending Review

#5 Updated by Dan Bode almost 4 years ago

it did not pass the tests that are listed in the ticket.

#6 Updated by Markus Roberts almost 4 years ago

  • Status changed from In Topic Branch Pending Review to Investigating

#7 Updated by Markus Roberts almost 4 years ago

  • Target version changed from 2.6.0 to 52

#8 Updated by Dan Bode over 3 years ago

  • Assignee deleted (Dan Bode)

#9 Updated by James Turnbull over 3 years ago

  • Assignee set to Nigel Kersten
  • Target version changed from 52 to 2.7.x

Nigel –

#10 Updated by Nigel Kersten over 3 years ago

  • Status changed from Investigating to Accepted
  • Assignee deleted (Nigel Kersten)

#11 Updated by Daniel Pittman over 2 years ago

  • Subject changed from --parseonly does not check resource parameters to `puppet parser validate` does not check resource parameters
  • Description updated (diff)

The specific functionality, --parseonly, has been deprecated in favour of puppet parser validate, but the underlying issue remains.

The actual challenge is that we really need almost an entire parser run to achieve the second half (defined types), and for the user to supply all the data the compiler would have.

Just doing parameter checking for known types would almost be easy, except that same issue applies when custom types and providers come on the scene.

#12 Updated by Clay Caviness about 2 years ago

“puppet parser validate” has reallllly limited functionality as it stands, only really catching missing commas or mismatched braces.

Even obvious errors like file { '/tmp/foo': ensrue => file, } pass the parser, not to mention things like apricot { "carburetor": freeble => "munchkin", }

#13 Updated by Daniel Pittman about 2 years ago

  • Description updated (diff)

#14 Updated by Josh Cooper over 1 year ago

Going through the backlog. As of 2.7.18, puppet parser validate does not validate parameters. The paramcheck option was removed in https://github.com/puppetlabs/puppet/commit/4709e9b over two and a half years ago. Given that puppet apply --noop does validate the type, provider, parameters, etc, is there any reason to keep this issue open?

#15 Updated by Patrick Mohr over 1 year ago

Josh Cooper wrote:

Going through the backlog. As of 2.7.18, puppet parser validate does not validate parameters. The paramcheck option was removed in https://github.com/puppetlabs/puppet/commit/4709e9b over two and a half years ago. Given that puppet apply --noop does validate the type, provider, parameters, etc, is there any reason to keep this issue open?

So, my understanding is that paramcheck is cheap, in CPU and disk io. Also, I think all you need is the facts to compile the catalog. On the other hand, I believe that —noop will scream its head off if the source files don’t exist, meaning it’s not safe to fun on any computer. It has to be run on the computer you plan to apply the catalog to.

Because of this, I checked by compiling catalogs using cached facts.

So, I think a better question is if manually compiling catalogs is a good replacement.

#16 Updated by Nigel Kersten over 1 year ago

  • Assignee set to eric sorenson

Josh Cooper wrote:

Going through the backlog. As of 2.7.18, puppet parser validate does not validate parameters. The paramcheck option was removed in https://github.com/puppetlabs/puppet/commit/4709e9b over two and a half years ago. Given that puppet apply --noop does validate the type, provider, parameters, etc, is there any reason to keep this issue open?

Yes.

noop still exports resources, updates facts in the inventory service, and basically has a whole bunch of implicit side-effects that mean that it’s unsuitable for a pre-commit hook in your version control system.

#17 Updated by Nigel Kersten over 1 year ago

  • Target version deleted (2.7.x)

#18 Updated by Josh Cooper over 1 year ago

  • Keywords set to goalie_06_28_2012

#19 Updated by Charlie Sharpsteen about 1 year ago

  • Keywords changed from goalie_06_28_2012 to goalie_06_28_2012 customer

Also available in: Atom PDF