From 8efb70c84346a3c1ea2e0582321760bad96da423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 21 Mar 2023 15:51:15 +0100 Subject: Introduce include_default. --- manifests/init.pp | 15 ++++++++++----- manifests/repo.pp | 2 +- manifests/setup.pp | 9 +++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 manifests/setup.pp diff --git a/manifests/init.pp b/manifests/init.pp index 4deaf9a..9b65050 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,6 +9,8 @@ # @param mirrorlist # @param update # Should 'pacman -Sy' be run after changes to the configuration? +# @param include_default +# Should Archlinux' regular repositories be included class pacman ( String $hooks_path = '/etc/pacman.d/hooks-puppet', String $conf_path = '/etc/pacman.conf', @@ -16,6 +18,7 @@ class pacman ( Optional[Integer] $parallel_downloads = undef, String $mirrorlist = "puppet:///modules/${module_name}/mirrorlist", Boolean $update = false, + Boolean $include_default = true, ) { $hooks_ = [$hooks_path] $parallel_downloads_ = if versioncmp($facts['pacman-version'], '6.0.0') != -1 { @@ -24,11 +27,7 @@ class pacman ( false } - concat { $conf_path: - ensure => present, - order => 'numeric', - backup => true, - } + include pacman::setup if $update { exec { 'pacman -Sy': @@ -61,4 +60,10 @@ class pacman ( backup => true, source => $mirrorlist, } + + if $include_default { + pacman::repo { ['core', 'extra', 'community']: + include => '/etc/pacman.d/mirrorlist', + } + } } diff --git a/manifests/repo.pp b/manifests/repo.pp index 8607853..e2ee780 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -25,7 +25,7 @@ define pacman::repo ( Optional[String] $server = undef, Optional[Array[String,1]] $source = undef, ) { - require pacman + require pacman::setup if $repo_name == 'local' { fail('Repo name "local" is reserved by Pacman') diff --git a/manifests/setup.pp b/manifests/setup.pp new file mode 100644 index 0000000..3f8a31c --- /dev/null +++ b/manifests/setup.pp @@ -0,0 +1,9 @@ +# @api private +class pacman::setup ( +) { + concat { $pacman::conf_path: + ensure => present, + order => 'numeric', + backup => true, + } +} -- cgit v1.2.3