Project

General

Profile

Refactor #14450

Replace use of Puppet parser functions in parameter validations

Added by Dominic Cleal over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Difficulty:
Triaged:
No
Bugzilla link:

Description

kafo_parsers returns a list of validations for each Puppet module, referencing Puppet::Parser AST objects. This should be replaced by a more generic validation mechanism or at worst, removed/discarded.

Using parser functions directly will be difficult with Puppet under AIO, as the classes won't be accessible. This will also be a problem with the parser cache in #14447 as it will serialise these classes on Puppet 3 but be unable to deserialise them.

One possibility might be to reimplement or redistribute with modifications the functions from stdlib in Kafo (or another gem) and then use standard naming to load the validation checks instead of serialising the class.

This will also have the benefit of removing some complex code that loads parser functions from the Puppet modulepath inside Kafo.


Related issues

Blocks Foreman - Tracker #8447: Puppet 4 supportClosed2014-11-19

Associated revisions

Revision 7a1648e0 (diff)
Added by Dominic Cleal over 5 years ago

fixes #14450 - replace validation functions with internal impls (#137)

Currently kafo_parsers returns a list of validation functions using the
Puppet AST, and kafo loads these from the modulepath and executes them
in a mock Puppet environment.

This reimplements the common stdlib functions in kafo, removing the need
to set up and run Puppet functions themselves. The code accepts either
the existing AST objects or simpler objects from the parser that respond
to #name and #arguments, allowing this to be switched out in
kafo_parsers later (so the Puppet library isn't needed at all).

Revision 4a562711 (diff)
Added by Dominic Cleal over 5 years ago

refs #14450 - remove Puppet ASTs from validations list

History

#1 Updated by Dominic Cleal over 5 years ago

#2 Updated by Dominic Cleal over 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

#3 Updated by Dominic Cleal over 5 years ago

I think I'm going to simplify the interface between the two gems not to pass the parsed AST objects back, and instead pass the function name and arguments.

In kafo we can re-implement the common validation functions from the stdlib documentation/spec. foreman-installer only uses:

validate_absolute_path
validate_array
validate_bool
validate_hash
validate_integer
validate_listen_on (from puppet-foreman_proxy)
validate_re
validate_string

I'm unsure if this will be required after Puppet 2+3 support is dropped, as the data types in 4 are more descriptive and will replace almost all validation (#14500).

#4 Updated by The Foreman Bot over 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/kafo/pull/137 added

#5 Updated by The Foreman Bot over 5 years ago

  • Pull request https://github.com/theforeman/kafo_parsers/pull/17 added

#6 Updated by Dominic Cleal over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF