From 7ce3190986cf8e5fe037a7ccd4c1076505b117f4 Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 12 Jul 2016 16:41:59 -0400 Subject: remove submodules in preparation for move to subrepos Change-Id: Ia7655153b556337f676e3d909559c4a7306bedd6 --- puppet/modules/concat | 1 - 1 file changed, 1 deletion(-) delete mode 160000 puppet/modules/concat (limited to 'puppet/modules/concat/manifests/fragment.pp') diff --git a/puppet/modules/concat b/puppet/modules/concat deleted file mode 160000 index abce1280..00000000 --- a/puppet/modules/concat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit abce1280e07b544d8455f1572dd870bbd2f14892 -- cgit v1.2.3 From b85f8c1b914a09b6001d4c1b5c7d07ef17ac766f Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 12 Jul 2016 16:45:27 -0400 Subject: git subrepo clone https://leap.se/git/puppet_concat puppet/modules/concat subrepo: subdir: "puppet/modules/concat" merged: "abce128" upstream: origin: "https://leap.se/git/puppet_concat" branch: "master" commit: "abce128" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: Ic28e31bdc5b32fd6c55636bc35d9ca2967daf997 --- puppet/modules/concat/manifests/fragment.pp | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 puppet/modules/concat/manifests/fragment.pp (limited to 'puppet/modules/concat/manifests/fragment.pp') diff --git a/puppet/modules/concat/manifests/fragment.pp b/puppet/modules/concat/manifests/fragment.pp new file mode 100644 index 00000000..943bf671 --- /dev/null +++ b/puppet/modules/concat/manifests/fragment.pp @@ -0,0 +1,49 @@ +# Puts a file fragment into a directory previous setup using concat +# +# OPTIONS: +# - target The file that these fragments belong to +# - content If present puts the content into the file +# - source If content was not specified, use the source +# - order By default all files gets a 10_ prefix in the directory +# you can set it to anything else using this to influence the +# order of the content in the file +# - ensure Present/Absent or destination to a file to include another file +# - mode Mode for the file +# - owner Owner of the file +# - 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}" + + # 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 } } + } + } + default: { File{ content => $content } } + } + + file{"${fragdir}/fragments/${order}_${safe_name}": + ensure => $ensure, + mode => $mode, + owner => $owner, + group => $group, + backup => $backup, + alias => "concat_fragment_${name}", + notify => Exec["concat_${target}"] + } +} -- cgit v1.2.3