From df8b5e435e62d08440b04eada7304519fb020879 Mon Sep 17 00:00:00 2001
From: Thomas Bellman <bellman@lysator.liu.se>
Date: Mon, 4 Oct 2021 22:17:37 +0200
Subject: [PATCH] unit_options: Don't require options when ensure absent.

When setting ensure = absent to systemd::unit_options, it doesn't
make sense for users to have to specify the options parameter.  But
it was a mandatory parameter, so they had to.  Fix that.
---
 manifests/unit_options.pp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/manifests/unit_options.pp b/manifests/unit_options.pp
index 1fb646b..5387c65 100644
--- a/manifests/unit_options.pp
+++ b/manifests/unit_options.pp
@@ -44,7 +44,7 @@ define systemd::unit_options(
 	# reset that option to the empty list, as systemd would otherwise
 	# just append the new value(s) to the existing list.
 	#
-	$options,
+	$options=undef,
 
 	# List of comment lines to add to the start of the parameter file.
 	# The list may be nested, and individual "lines" are allowed to
@@ -77,6 +77,10 @@ define systemd::unit_options(
     case $ensure
     {
 	'present': {
+	    if ($options == undef) {
+		fail("Systemd::Unit_options[${title}]:",
+		     "Parameter 'options' required when ensure = present")
+	    }
 	    cfgfile::directory_parents {
 		$filepath:
 		    top => $systemd::vars::etcdir,
-- 
GitLab