language-puppet-0.4.0: Tools to parse and evaluate the Puppet DSL.

Safe HaskellNone

Puppet.Interpreter.Catalog

Description

This module exports the getCatalog function, that computes catalogs from parsed manifests. The behaviour of this module is probably non canonical on many details. The problem is that most of Puppet behaviour is undocumented or extremely vague. It might be possible to delve into the source code or to write tests, but ruby is unreadable and tests are boring.

Here is a list of known discrepencies with Puppet :

  • Resources references using the <| |> syntax are not yet supported.
  • Things defined in classes that are not included cannot be accessed. In vanilla puppet, you can use subclass to classes that are not imported themselves.
  • Amending attributes with a reference will not cause an error when done out of an inherited class.
  • Variables $0 to $9, set after regexp matching, are not handled.
  • Tags work like regular parameters, and are not automatically populated or inherited.
  • Modules, nodes, classes and type names starting with _ are allowed.
  • Arrows between resource declarations or collectors are not yet handled.
  • Reversed form arrows are not handled.
  • Node inheritance is not handled, and class inheritance seems to work well, but is probably not Puppet-perfect.

Synopsis

Documentation

getCatalogSource

Arguments

:: (TopLevelType -> Text -> IO (Either String Statement))

The "get statements" function. Given a top level type and its name it should return the corresponding statement.

-> (Either Text Text -> Text -> Map Text GeneralValue -> IO (Either String Text))

The "get template" function. Given a file name, a scope name and a list of variables, it should return the computed template.

-> (Text -> Query -> IO (Either String Value))

The "puppetDB Rest API" function. Given the machine fqdn, a request type (resources, nodes, facts, ..) and a query, it returns a JSON value, or some error.

-> Text

Name of the node.

-> Facts

Facts of this node.

-> Maybe Text

Path to the modules, for user plugins. If set to Nothing, plugins are disabled.

-> Map PuppetTypeName PuppetTypeMethods

The list of native types

-> IO (Either String (FinalCatalog, EdgeMap, FinalCatalog), [Text]) 

This function returns an error, or the FinalCatalog of resources to apply, the map of all edges between resources, and the FinalCatalog of exported resources.