The language-puppet website.

Work with your manifests!

Version 0.9.0 Is Out for Testing

Finally the huge rewrite is almost done !

It is beta

It is now only accessible though GitHub, in the beta branch. It uses another highly experimental module : filecache. This module should provide a quick and easy method for caching the result of an IO computation on a file. It uses hinotify for cache expiration, and is completely untested !

The behaviour of the interpreter is radically different from the previous version in many ways. It should hopefully be a better approximation of the “real” Puppet implementation. This is one of the major goals of this rewrite, especially concerning resource dependencies that were totally off the mark in the previous version.

On the other hand, most of the documentation has disappeared.

Performance improvements

The second goal is to increase performances. In order to do so, several radical changes have been performed :

  • The Ruby interpreter now lives in its own system thread, which is pretty useful as this package now only works with the threaded runtime !
  • The “unresolved” types that lived between parsing and final interpretation have been ditched.
  • All important types are now strict, and the strict-base-types module is well used.

I do not have hard numbers right now, but now that everything is strict using more cores actually speeds things up. This is still not perfect and will require tuning, but this is much better than the previous state of affairs. The parser seems a bit slower (between 10% and 30%), but the interpreter is much faster. This means that single testing is a bit slower (about 5% slower), but future embedding in a long lived process will give a huge performance increase.

Nicer codebase

First of all, the lens package is now used everywhere. This might look like obfuscation for those not used to it, but I believe it is incredibly nice, especially when working with a complex state.

The parser has been completely rewritten, using the parsers abstraction, with a little hack to use Parsec underneath with my own “lexeme” function. I would have liked to use trifecta for its nicer error messages, but I could not find how to do the same trick with it.

Speaking of which, now almost all text is pretty printed in color. This is noticeably slower when rendering a large catalog, but so much nicer to the eyes it is well worth it.

The “puppetresources” and “facter” modules are now merged, and will be marked as deprecated when this version stabilizes.

There is still a lot of work to do with it, but the testing API should be much easier to use. I am considering writing a DSL to it so that it wouldn’t require a development environment to test stuff.

Finally, there used to be a lot of tuples in the type signatures that are now replaced by proper types, making function signatures much more expressive.

before.hs
1
_unresolvedRels :: ![([(LinkType, GeneralValue, GeneralValue)], (T.Text, GeneralString), RelUpdateType, SourcePos, [[ScopeName]])],
after.hs
1
2
3
4
5
6
_extraRelations     :: ![LinkInformation]
data LinkInformation = LinkInformation { _linksrc  :: !RIdentifier
                                       , _linkdst  :: !RIdentifier
                                       , _linkType :: !LinkType
                                       , _linkPos  :: !PPosition
                                       }

Comments