- make the root group configurable in the concat::setup class for portability

- use sh and not bash
This commit is contained in:
Pierre-Yves Ritschard 2011-02-03 17:58:09 +00:00 committed by R.I.Pienaar
parent 3c46b82d09
commit 031bf26128
5 changed files with 9 additions and 7 deletions

View file

@ -26,3 +26,4 @@ CHANGELOG:
- 2010/07/14 - Add support for setting the filebucket behavior of files
- 2010/10/04 - Make the warning message configurable
- 2010/12/03 - Add flags to make concat work better on Solaris - thanks Jonathan Boyett
- 2011/02/03 - Make the shell script more portable and add a config option for root group

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Script to concat files to a config file.
#

View file

@ -13,7 +13,7 @@
# - group Owner of the file
# - backup Controls the filebucketing behavior of the final file and
# see File type reference for its use. Defaults to 'puppet'
define concat::fragment($target, $content='', $source='', $order=10, $ensure = "present", $mode = 0644, $owner = root, $group = root, $backup = "puppet") {
define concat::fragment($target, $content='', $source='', $order=10, $ensure = "present", $mode = 0644, $owner = root, $group = $concat::setup::root_group, $backup = "puppet") {
$safe_name = regsubst($name, '/', '_', 'G')
$safe_target_name = regsubst($target, '/', '_', 'G')
$concatdir = $concat::setup::concatdir

View file

@ -87,7 +87,7 @@
# ALIASES:
# - The exec can notified using Exec["concat_/path/to/file"] or Exec["concat_/path/to/directory"]
# - The final file can be referened as File["/path/to/file"] or File["concat_/path/to/file"]
define concat($mode = 0644, $owner = "root", $group = "root", $warn = "false", $force = "false", $backup = "puppet", $gnu = "true", $order="alpha") {
define concat($mode = 0644, $owner = "root", $group = $concat::setup::root_group, $warn = "false", $force = "false", $backup = "puppet", $gnu = "true", $order="alpha") {
$safe_name = regsubst($name, '/', '_', 'G')
$concatdir = $concat::setup::concatdir
$version = $concat::setup::majorversion
@ -127,7 +127,7 @@ define concat($mode = 0644, $owner = "root", $group = "root", $warn = "false", $
File{
owner => root,
group => root,
group => $group,
mode => $mode,
backup => $backup
}
@ -165,7 +165,7 @@ define concat($mode = 0644, $owner = "root", $group = "root", $warn = "false", $
exec{"concat_${name}":
user => root,
group => root,
group => $group,
notify => File[$name],
subscribe => File[$fragdir],
alias => "concat_${fragdir}",

View file

@ -13,12 +13,13 @@
#
# It also copies out the concatfragments.sh file to /usr/local/bin
class concat::setup {
$root_group = 0
$concatdir = "/var/lib/puppet/concat"
$majorversion = regsubst($puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')
file{"/usr/local/bin/concatfragments.sh":
owner => root,
group => root,
group => $root_group,
mode => 755,
source => $majorversion ? {
24 => "puppet:///concat/concatfragments.sh",
@ -28,7 +29,7 @@ class concat::setup {
$concatdir:
ensure => directory,
owner => root,
group => root,
group => $root_group,
mode => 755;
}
}