TomPoulton/hiera-eyaml — pull request #29 by sihil (2013-09-18 16:47:26+00:00)
Title: Enhance edit mode

Implement issue #25 to make edits in edit mode less noisy. Prior to this, edit mode would re-encrypt every decrypted value, regardless of whether it had been edited in its plain text form. Since you never get the same value twice when you encrypt a value (for good encryption schemes at least) then this generates a lot of noise and you can no longer look at git history to see which value was changed.

In order to implement this it made sense to create a parser that could parse a eyaml file and return an array of tokens, with each token representing either an encrypted block or a block of normal text. With these tokens it becomes very easy to transform to a variety of output formats and also retain the original file content for comparison. The encrypt and decrypt actions were re-written and simplified to use the parser.

To track the encrypted blocks, each DEC block is now followed by an id in parentheses. This id is parsed at the end of edit mode and compared to the original block.

The parser has a reasonable set of unit tests around it.