From 031bf261289dcbb32e63b053ed5b3a82117698c0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ritschard Date: Thu, 3 Feb 2011 17:58:09 +0000 Subject: - make the root group configurable in the concat::setup class for portability - use sh and not bash --- CHANGELOG | 1 + files/concatfragments.sh | 2 +- manifests/fragment.pp | 2 +- manifests/init.pp | 6 +++--- manifests/setup.pp | 5 +++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 238d246..c506cf1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/files/concatfragments.sh b/files/concatfragments.sh index a8d8765..52fd684 100644 --- a/files/concatfragments.sh +++ b/files/concatfragments.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Script to concat files to a config file. # diff --git a/manifests/fragment.pp b/manifests/fragment.pp index 890d43a..7afc4c0 100644 --- a/manifests/fragment.pp +++ b/manifests/fragment.pp @@ -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 diff --git a/manifests/init.pp b/manifests/init.pp index 909d7b6..3a17346 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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}", diff --git a/manifests/setup.pp b/manifests/setup.pp index 9676fb6..77ba47f 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -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; } } -- cgit v1.2.3