Forge Home

retrypuppet

Simple python script to retry puppet agent execution if the agent is already running.

7,259 downloads

6,708 latest version

4.3 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.1.0 (latest)
  • 1.0.1
  • 1.0.0
released Mar 7th 2017
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 3.0.0 < 5.0.0
  • RedHat, CentOS, OracleLinux, Scientific, Debian, Ubuntu, FreeBSD, OpenBSD, Gentoo, ArchLinux

Start using this module

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

Add this module to your Puppetfile:

mod 'aolabs-retrypuppet', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add aolabs-retrypuppet
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install aolabs-retrypuppet --version 1.1.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

aolabs/retrypuppet — version 1.1.0 Mar 7th 2017

retrypuppet

Build Status Coverage GitHub Issues Puppet Forge Version Puppet Forge Downloads Maintained by AO Labs

Table of Contents

  1. Description
  2. Usage
  3. Contributors
  4. ChangeLog

Description

Provides a simple python based wrapper script around puppet agent to automatically retry in the event that a run is already in progress.

Where the puppet agent is polling at a high frequency, whether in "apply" mode or "noop" mode for audit purposes, it is likely that any manual agent run will clash with the agent already running in the background. This can be especially irritating where an orchestration tool such as mCollective or Salt is used to run puppet - perhaps as part of a deployment process.

# puppet agent -tv
Notice: Run of Puppet configuration client already in progress; skipping  (/opt/puppetlabs/puppet/cache/state/agent_catalog_run.lock exists)

Usage

Add the below to your manifests for any machine on which you want to run puppet agent:

class { '::retrypuppet': }

Then simply use the retrypuppet wrapper script in place of the puppet binary. The script passes any arguments specified on its command-line directly to the puppet binary, passes any output from the puppet binary on its standard output (note that any agent output to stderr will be flattened to stdout), and will return Puppet's returncode as its returncode. If the agent returns a notice that a run is already in progress, then retrypuppet will wait for a 30 second back-off period before trying again. After 10 "blocked" attempts, retrypuppet will exit returning 11 (EAGAIN). To reduce noise, retrypuppet will not display any output from a blocked run other than a notice.

# retrypuppet agent -tv
Run already in progress, will retry in 30 seconds, 9 attempts remain...
Run already in progress, will retry in 30 seconds, 8 attempts remain...
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for centos-puppet.localdomain
Info: Applying configuration version '1488412377'
Notice: Applied catalog in 1.14 seconds

Contributors

Original module authored by Patrick Brennan and released under the LGPLv3 license courtesy of Hapara LLC. Ongoing maintenance by AO Labs courtesy of Patrick Brennan.

ChangeLog

  • 1.1.0 Documentation updates, Travis-CI test integration, return puppet's return code (issue #45).
  • 1.0.1 Support Python 2 and 3.
  • 1.0.0 Initial release, Python 3 only.