From 800bec11aeacd64dac18935c6b6074ea6be14be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Dal=C3=A9n?= Date: Wed, 14 Mar 2012 18:02:43 +0100 Subject: Style guideline fixes Comply better with puppet community style guidelines. Change-Id: Ie1782d266539b1a8f9890b2ade77280011aa22aa --- manifests/fragment.pp | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) (limited to 'manifests/fragment.pp') diff --git a/manifests/fragment.pp b/manifests/fragment.pp index 97c0d9c..943bf67 100644 --- a/manifests/fragment.pp +++ b/manifests/fragment.pp @@ -13,39 +13,37 @@ # - 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 = $::id, $group = $concat::setup::root_group, $backup = "puppet") { - $safe_name = regsubst($name, '/', '_', 'G') - $safe_target_name = regsubst($target, '/', '_', 'G') - $concatdir = $concat::setup::concatdir - $fragdir = "${concatdir}/${safe_target_name}" +define concat::fragment($target, $content='', $source='', $order=10, $ensure = 'present', $mode = '0644', $owner = $::id, $group = $concat::setup::root_group, $backup = 'puppet') { + $safe_name = regsubst($name, '/', '_', 'G') + $safe_target_name = regsubst($target, '/', '_', 'G') + $concatdir = $concat::setup::concatdir + $fragdir = "${concatdir}/${safe_target_name}" - # if content is passed, use that, else if source is passed use that - # if neither passed, but $ensure is in symlink form, make a symlink - case $content { - "": { - case $source { - "": { - case $ensure { - "", "absent", "present", "file", "directory": { - crit("No content, source or symlink specified") - } - } - } - default: { File{ source => $source } } - } + # if content is passed, use that, else if source is passed use that + # if neither passed, but $ensure is in symlink form, make a symlink + case $content { + '': { + case $source { + '': { + case $ensure { + '', 'absent', 'present', 'file', 'directory': { + crit('No content, source or symlink specified') } - default: { File{ content => $content } } + } + } + default: { File{ source => $source } } + } } + default: { File{ content => $content } } + } - file{"${fragdir}/fragments/${order}_${safe_name}": - mode => $mode, - owner => $owner, - group => $group, - ensure => $ensure, - backup => $backup, - alias => "concat_fragment_${name}", - notify => Exec["concat_${target}"] - } + file{"${fragdir}/fragments/${order}_${safe_name}": + ensure => $ensure, + mode => $mode, + owner => $owner, + group => $group, + backup => $backup, + alias => "concat_fragment_${name}", + notify => Exec["concat_${target}"] + } } - -# vi:tabstop=4:expandtab:ai -- cgit v1.2.3