puppetlabs/puppet-acceptance — pull request #123 by cprice-puppet (2012-01-25 22:58:52+00:00)
Title: allow extra environment vars for puppet commands

When working on some tickets relating to setting system locales (Facter #12012, Puppet #11860), I came across a situation where I needed to be able to set some environment variables before running puppet commands in my acceptance tests. This changeset adds the ability to pass in an optional ":environment" hash when calling "apply_manifest_on"; the key/value pairs in this hash will be set as environment variables for the duration of the execution of the "puppet apply" operation.

This implementation isn't ideal, but the implementation details are not very visible in the actual acceptance test syntax. We might want to re-work the implementation later, but for now this was the only reasonably easy way to pull it off.

Also--this logic could very easily be extended to work for other puppet commands besides "apply", but hasn't at this point in time.