summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/rdoc/code_objects.rb
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2011-02-23 14:59:13 -0800
committerPaul Berry <paul@puppetlabs.com>2011-02-23 15:12:53 -0800
commit23b711954b1c1ba8deb4035503797c2f38a8ce12 (patch)
tree967c9f7ff9a5d546224584ea0dc06c0596ab8a2d /lib/puppet/util/rdoc/code_objects.rb
parent7898345acef254ced9316e5a90104609ccb16c2e (diff)
downloadpuppet-23b711954b1c1ba8deb4035503797c2f38a8ce12.tar.gz
puppet-23b711954b1c1ba8deb4035503797c2f38a8ce12.tar.xz
puppet-23b711954b1c1ba8deb4035503797c2f38a8ce12.zip
Maint: Add an assertion mechanism to Puppet
This patch allows us to make C-style "assertions" in Puppet code, e.g.: assert_that { condition } assert_that(message) { condition } These methods will raise an exception if the environment variable PUPPET_ENABLE_ASSERTIONS is set to a non-empty value, and the the condition evaluates to false. If the environment variable PUPPET_ENABLE_ASSERTIONS is not set, then the condition is not even checked. Switching the assertions on with PUPPET_ENABLE_ASSERTIONS carries three advantages: 1. It makes it possible to put potentially expensive checks in assertions without degrading the performance of the code in production environments. 2. It allows strict assertions to catch Puppet bugs early in development, without increasing the risk of a crash in production environments. 3. It allows a simple command-line mechanism to run any Puppet command with assertions enabled.
Diffstat (limited to 'lib/puppet/util/rdoc/code_objects.rb')
0 files changed, 0 insertions, 0 deletions