Forge Home

puppet_mutex

Do-nothing define to implement a mutex between classes, defines, etc.

10,970 downloads

10,219 latest version

3.1 quality score

Version information

  • 1.0.0 (latest)
  • 0.1.0
released Nov 6th 2014
This version is compatible with:
  • Puppet Enterprise 3.x
  • Puppet >=2.7.20 <4.0.0
  • Fedora, RedHat, CentOS, Scientific, SLES, Debian, Ubuntu

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'wcooley-puppet_mutex', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add wcooley-puppet_mutex
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install wcooley-puppet_mutex --version 1.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

wcooley/puppet_mutex — version 1.0.0 Nov 6th 2014

puppet_mutex

Do-nothing define to clearly express and enforce mutal exclusivity between classes or defines.

Sometimes one has classes which, while otherwise unrelated, should never both be declared for the same host. For example, one generally cannot manage local accounts while LDAP is configured for managing accounts. There is no obvious error that this should be so, except that the useradd provider for the user type will fail with some incomprehensible message. Pretty much everything else will work, however, so noticing the error requires looking for it.

With a puppet_mutex with the same name declared in both classes, the catalog will fail to compile so mistakes are easier to notice.Moreover, a declaration with this define clearly expresses the intention that the two classes should never both be declare.

Attempting to use the defined function to enforce exclusivity is unreliable, as it is parse-order dependent and generally suggested against.

Parameters

None.

Variables

None.

Examples

To ensure that account::ldap and account::local cannot be both declared at the same time, declare the same puppet_mutex in both classes.

class account::ldap {
  puppet_mutex { 'user-account': }
}

class account::local {
  puppet_mutex { 'user-account': }
}

Author

Wil Cooley <wcooley@nakedape.cc>

Copyright

Copyright 2014 Wil Cooley