Skip to content
Snippets Groups Projects
Commit 955de344 authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Move directory paths to separate class.

This adds the semi-internal class 'systemd::vars' containing various
paths and other constants for use in the rest of the module, so we
won't need to repeat ourselves.  Currently only contains a single
variable, $etcdir, pointing to /etc/systemd/system.
parent 2fd869a5
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,7 @@ define systemd::unit_options( ...@@ -57,6 +57,7 @@ define systemd::unit_options(
$ensure='present', $ensure='present',
) )
{ {
include systemd::vars
include systemd::daemon_reload include systemd::daemon_reload
if ($name =~ /^([^\/.]+)\.([^\/.]+)\/(.+)$/) { if ($name =~ /^([^\/.]+)\.([^\/.]+)\/(.+)$/) {
...@@ -69,8 +70,7 @@ define systemd::unit_options( ...@@ -69,8 +70,7 @@ define systemd::unit_options(
" ``${name}''") " ``${name}''")
} }
$etcdir = '/etc/systemd/system' $unitdir = "${systemd::vars::etcdir}/${unitname}.${unittype}.d"
$unitdir = "${etcdir}/${unitname}.${unittype}.d"
$filepath = "${unitdir}/${filename}.conf" $filepath = "${unitdir}/${filename}.conf"
case $ensure case $ensure
...@@ -78,7 +78,7 @@ define systemd::unit_options( ...@@ -78,7 +78,7 @@ define systemd::unit_options(
'present': { 'present': {
cfgfile::directory_parents { cfgfile::directory_parents {
$filepath: $filepath:
top => $etcdir, top => $systemd::vars::etcdir,
owner => 'root', group => 'root', mode => '0755'; owner => 'root', group => 'root', mode => '0755';
} }
file { file {
......
# Copyright © 2021 Thomas Bellman, Linköping, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Various constants (file paths, et.c). Not overridable by users.
* Mostly intended for internal use.
*/
class systemd::vars
{
$etcdir = '/etc/systemd/system'
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment