Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
- Puppet >= 6.21.0 < 8.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'puppetlabs-bash_task_helper', '2.0.0'
Learn more about managing modules with a PuppetfileDocumentation
bash_task_helper
A Bash helper library for use by Puppet Tasks.
Table of Contents
- Description
- Requirements
- Setup - The basics of getting started with bash_task_helper
- Usage - Configuration options and additional functionality
- Development - Guide for contributing to the module
Description
This library handles producing a formatted error message for errors from stderr and uses indirection to munge PT_ environment variables.
Requirements
- bash >= 4.0 on the primary Puppet server
Setup
To use this, include this module in a Puppetfile
mod 'puppetlabs-bash_task_helper'
Add it to your task metadata
{
"files": ["bash_task_helper/files/task_helper.sh"],
"input_method": "environment"
}
Usage
In your task, source the helper script and you can use the fail and sucess funtions. Sucess outputs your provided output and fail outputs any provided output and appends stderr if applicable.
mymodule/tasks/mytask.sh
#!/bin/bash
declare PT__installdir
source "$PT__installdir/bash_task_helper/files/task_helper.sh"
if puppet resource service puppet | grep -q stopped; then
#Start the Puppet service
puppet resource service puppet ensure=running || fail "Couldn't start puppet service"
else
fail "Puppet is already running or not installed"
fi
success '{ "status": "success" }'
How to Report an issue or contribute to the module
If you are a PE user and need support using this module or are encountering issues, our Support team would be happy to help you resolve your issue and help reproduce any bugs. Just raise a ticket on the support portal.
If you have a reproducible bug or are a community user you can raise it directly on the Github issues page of the module here. We also welcome PR contributions to improve the module. Please see further details about contributing here.
Change log
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
v2.0.0 (2022-07-11)
Changed
v1.0.0 (2021-11-16)
* This Changelog was automatically generated by github_changelog_generator
Quality checks
We run a couple of automated scans to help you assess a module’s quality. Each module is given a score based on how well the author has formatted their code and documentation and select 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.
Malware scan results
The malware detection service on Puppet Forge is an automated process that identifies known malware in module releases before they’re published. It is not intended to replace your own virus scanning solution.
Learn more about malware scans- Module name:
- puppetlabs-bash_task_helper
- Module version:
- 2.0.0
- Scan initiated:
- July 11th 2022, 7:43:29
- Detections:
- 0 / 57
- Scan stats:
- 57 undetected
- 0 harmless
- 0 failures
- 0 timeouts
- 0 malicious
- 0 suspicious
- 15 unsupported
- Scan report:
- View the detailed scan report