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

Safe HaskellNone
LanguageHaskell98

Puppet.Daemon

Contents

Synopsis

Documentation

data Daemon Source

API for the Daemon. The main method is getCatalog: given a node and a list of facts, it returns the result of the compilation. This will be either an error, or a tuple containing: - all the resources in this catalog - the dependency map - the exported resources - a list of known resources, that might not be up to date, but are here for code coverage tests.

Notes :

  • 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. Some good practices are enforced, particularly in strict mode. For instance, unknown variables are always an error. Querying a dictionary with a non existent key returns undef in puppet, whereas it would throw an error in strict mode.

initDaemon :: Preferences IO -> IO Daemon Source

Entry point to get a Daemon It will initialize the parsing and interpretation infrastructure from the Preferences.

Internally it initializes 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 optionally talk with PuppetDB, by setting an URL via the prefPDB. The recommended way to set it to http://localhost:8080 and set a SSH tunnel :

ssh -L 8080:localhost:8080 puppet.host

Utils

checkError :: Show e => Doc -> Either e a -> IO a Source

In case of a Left value, print the error and exit immediately

Re-exports

module Puppet.PP