From 32f9d6f1c281236f7c98d2ce2b7ea4360ad55351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 21 Mar 2023 16:39:29 +0100 Subject: Better handling of mirrorfile. --- manifests/init.pp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9b65050..e992d7f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,7 +6,14 @@ # @param ilovecandy # It's a secret to everybody. # @param parallel_downloads -# @param mirrorlist +# @param mirrorlist_source +# Contents of default mirrorlist file. +# Mutually exclusive with $mirrorlist_content. +# @param mirrorlist_content +# Source url of default mirrorlist file. +# Mutually exclusive with $mirrorlist_source. +# @param mirrorlist_file +# Path to default mirrorlist file. # @param update # Should 'pacman -Sy' be run after changes to the configuration? # @param include_default @@ -16,7 +23,9 @@ class pacman ( String $conf_path = '/etc/pacman.conf', Boolean $ilovecandy = false, Optional[Integer] $parallel_downloads = undef, - String $mirrorlist = "puppet:///modules/${module_name}/mirrorlist", + Optional[String] $mirrorlist_source = undef, + Optional[String] $mirrorlist_content = undef, + String $mirrorlist_file = '/etc/pacman.d/mirrorlist', Boolean $update = false, Boolean $include_default = true, ) { @@ -56,14 +65,22 @@ class pacman ( purge => true, } - file { '/etc/pacman.d/mirrorlist': - backup => true, - source => $mirrorlist, + if $mirrorlist_source == undef and $mirrorlist_content == undef { + file { $mirrorlist_file: + backup => true, + source => "puppet:///modules/${module_name}/mirrorlist", + } + } else { + file { $mirrorlist_file: + backup => true, + source => $mirrorlist_source, + content => $mirrorlist_content, + } } if $include_default { pacman::repo { ['core', 'extra', 'community']: - include => '/etc/pacman.d/mirrorlist', + include => $mirrorlist_file, } } } -- cgit v1.2.3