- make the root group configurable in the concat::setup class for portability
- use sh and not bash
This commit is contained in:
parent
3c46b82d09
commit
031bf26128
5 changed files with 9 additions and 7 deletions
|
@ -26,3 +26,4 @@ CHANGELOG:
|
||||||
- 2010/07/14 - Add support for setting the filebucket behavior of files
|
- 2010/07/14 - Add support for setting the filebucket behavior of files
|
||||||
- 2010/10/04 - Make the warning message configurable
|
- 2010/10/04 - Make the warning message configurable
|
||||||
- 2010/12/03 - Add flags to make concat work better on Solaris - thanks Jonathan Boyett
|
- 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
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Script to concat files to a config file.
|
# Script to concat files to a config file.
|
||||||
#
|
#
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# - group Owner of the file
|
# - group Owner of the file
|
||||||
# - backup Controls the filebucketing behavior of the final file and
|
# - backup Controls the filebucketing behavior of the final file and
|
||||||
# see File type reference for its use. Defaults to 'puppet'
|
# 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_name = regsubst($name, '/', '_', 'G')
|
||||||
$safe_target_name = regsubst($target, '/', '_', 'G')
|
$safe_target_name = regsubst($target, '/', '_', 'G')
|
||||||
$concatdir = $concat::setup::concatdir
|
$concatdir = $concat::setup::concatdir
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
# ALIASES:
|
# ALIASES:
|
||||||
# - The exec can notified using Exec["concat_/path/to/file"] or Exec["concat_/path/to/directory"]
|
# - 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"]
|
# - 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')
|
$safe_name = regsubst($name, '/', '_', 'G')
|
||||||
$concatdir = $concat::setup::concatdir
|
$concatdir = $concat::setup::concatdir
|
||||||
$version = $concat::setup::majorversion
|
$version = $concat::setup::majorversion
|
||||||
|
@ -127,7 +127,7 @@ define concat($mode = 0644, $owner = "root", $group = "root", $warn = "false", $
|
||||||
|
|
||||||
File{
|
File{
|
||||||
owner => root,
|
owner => root,
|
||||||
group => root,
|
group => $group,
|
||||||
mode => $mode,
|
mode => $mode,
|
||||||
backup => $backup
|
backup => $backup
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ define concat($mode = 0644, $owner = "root", $group = "root", $warn = "false", $
|
||||||
|
|
||||||
exec{"concat_${name}":
|
exec{"concat_${name}":
|
||||||
user => root,
|
user => root,
|
||||||
group => root,
|
group => $group,
|
||||||
notify => File[$name],
|
notify => File[$name],
|
||||||
subscribe => File[$fragdir],
|
subscribe => File[$fragdir],
|
||||||
alias => "concat_${fragdir}",
|
alias => "concat_${fragdir}",
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
#
|
#
|
||||||
# It also copies out the concatfragments.sh file to /usr/local/bin
|
# It also copies out the concatfragments.sh file to /usr/local/bin
|
||||||
class concat::setup {
|
class concat::setup {
|
||||||
|
$root_group = 0
|
||||||
$concatdir = "/var/lib/puppet/concat"
|
$concatdir = "/var/lib/puppet/concat"
|
||||||
$majorversion = regsubst($puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')
|
$majorversion = regsubst($puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')
|
||||||
|
|
||||||
file{"/usr/local/bin/concatfragments.sh":
|
file{"/usr/local/bin/concatfragments.sh":
|
||||||
owner => root,
|
owner => root,
|
||||||
group => root,
|
group => $root_group,
|
||||||
mode => 755,
|
mode => 755,
|
||||||
source => $majorversion ? {
|
source => $majorversion ? {
|
||||||
24 => "puppet:///concat/concatfragments.sh",
|
24 => "puppet:///concat/concatfragments.sh",
|
||||||
|
@ -28,7 +29,7 @@ class concat::setup {
|
||||||
$concatdir:
|
$concatdir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => root,
|
owner => root,
|
||||||
group => root,
|
group => $root_group,
|
||||||
mode => 755;
|
mode => 755;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue