HomePhorge

Maint: Add an assertion mechanism to Puppet
23b711954b1cUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

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.

  1. It allows strict assertions to catch Puppet bugs early in

development, without increasing the risk of a crash in production
environments.

  1. It allows a simple command-line mechanism to run any Puppet command

with assertions enabled.

Details

Provenance
Paul Berry <paul@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU7898345acef2: Merge branch 'ticket/2.6.next/6418' into 2.6.next
Branches
Unknown
Tags
Unknown

Event Timeline

Paul Berry <paul@puppetlabs.com> committed rPU23b711954b1c: Maint: Add an assertion mechanism to Puppet (authored by Paul Berry <paul@puppetlabs.com>).Feb 24 2011, 12:12 AM