diff --git a/manifests/include_file.pp b/manifests/include_file.pp index ce29992d91ff222c74a007fada58c03dbddc39b5..37c805b1df82ec61b52c5cbd00bd3d55b043b0a8 100644 --- a/manifests/include_file.pp +++ b/manifests/include_file.pp @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2022 Thomas Bellman. +# Copyright (C) 2014-2024 Thomas Bellman. # Licensed under the GNU LGPL v3+; see the README file for more information. @@ -15,7 +15,8 @@ define apache::include_file( # The content/source of the include file. These two parameters # have the same meaning as in the file type. Exactly one of them - # must be specified when the ensure parameter is set to 'present'. + # must be specified when the ensure parameter is set to 'present' + # or 'noinclude'. # $content = undef, $source = undef, @@ -35,6 +36,12 @@ define apache::include_file( # useful if the file should be included from another include # file. # + # - 'onlyinclude' + # Create the Include directive in the main httpd.conf file, + # but do not manage the actual file. This is useful if the + # file is managed in some other way (e.g. being installed + # from an RPM package). + # $ensure = 'present' ) { @@ -59,6 +66,9 @@ define apache::include_file( ensure => absent, notify => Class[apache::service]; } } + 'onlyinclude': { + # Nothing to do here + } default: { fail("Apache::Include_file[${title}]: ", "Bad parameter ensure: ${ensure}") @@ -67,10 +77,14 @@ define apache::include_file( case $ensure { - 'present': { + 'present', 'onlyinclude': { # Put the Include directive in place after the included file; if # the machine reboots in the middle, we do not want to needlessly # hose up the Apache service. + $filerequire = $ensure ? { + 'present' => File[$includefile], + 'onlyinclude' => [], + } ensure_line { "apache::include_file::include::${name}": file => $apache::configfile, @@ -78,7 +92,7 @@ define apache::include_file( addhow => append, require => [ Regexp_replace_lines['apache::base::no_include_all'], - File[$includefile] + $filerequire, ], notify => Class[apache::service]; }