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

Safe HaskellNone

Puppet.Daemon

Synopsis

Documentation

initDaemon :: Preferences IO -> IO DaemonMethodsSource

This is a high level function, that will initialize the parsing and interpretation infrastructure from the Prefs structure, and will return a function that will take a node name, Facts and return either an error or the FinalCatalog, along with the dependency graph and catalog of exported resources. It also return a few IO functions that can be used in order to query the daemon for statistics, following the format in Puppet.Stats.

It will internaly initialize a thread for the LUA interpreter, and a thread for the Ruby one. It should cache the AST of every .pp file, and could use a bit of memory. As a comparison, it fits in 60 MB with the author's manifests, but really breathes when given 300 MB of heap space. In this configuration, even if it spawns a ruby process for every template evaluation, it is way faster than the puppet stack.

It can optionnaly talk with PuppetDB, by setting an URL in the Prefs data structure. The recommended way to set it to http:localhost:8080 and set a SSH tunnel :

 ssh -L 8080:localhost:8080 puppet.host

Known bugs :

  • It might be buggy when top level statements that are not class/define/nodes are altered, or when files loaded with require are changed.
  • The catalog is not computed exactly the same way Puppet does. Take a look at Puppet.Interpreter.Catalog for a list of differences.
  • Parsing incompatibilities are listed in Puppet.DSL.Parser.
  • There might be race conditions because file status are checked before they are opened. This means the program might end with an exception when the file is nonexistent. This will need fixing.