From 1ee43b49e3d9a3c661ea43a630f4f86860837a95 Mon Sep 17 00:00:00 2001 From: roombaboomba <60388632+roombaboomba@users.noreply.github.com> Date: Fri, 27 Jan 2023 13:40:39 +0000 Subject: [PATCH] Add support for logging parameters in r10k.yml --- README.md | 21 +++++++++++++++++++++ manifests/config.pp | 3 +++ manifests/init.pp | 2 ++ manifests/params.pp | 1 + templates/r10k.yaml.erb | 3 +++ 5 files changed, 30 insertions(+) diff --git a/README.md b/README.md index 48b90d45..13de444a 100644 --- a/README.md +++ b/README.md @@ -891,6 +891,27 @@ This is the `deploy:` key in r10k, it accepts a hash that contains setting that } ``` +##### `log_settings` +This is the `logging:` key in r10k, it accepts a hash that contains settings for logging parameters. + +```puppet +    $log_settings = { +      outputs      => [ +        type       => 'file', +        level      => 'warn', +        parameters => { +          filename => '/var/log/r10k.log', +          trunc    => true, +        } +      ] +    } + + class {'r10k': + remote => 'git@github.com:acidprime/puppet.git', + log_settings => $log_settings, + } +``` + ##### `configfile_symlink` boolean if to manage symlink diff --git a/manifests/config.pp b/manifests/config.pp index 881a1f32..fda3cbfc 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -21,6 +21,8 @@ # Location of symlink that points to configfile. Default: /etc/r10k.yaml # * [*forge_settings*] # Hash containing settings for downloading modules from the Puppet Forge. +# * [*log_settings*] +# Hash containing settings for logging parameters. # * [*proxy*] # String containing proxy setting for r10k.yaml. # Default: undef @@ -64,6 +66,7 @@ Hash $git_settings = $r10k::params::git_settings, Hash $forge_settings = $r10k::params::forge_settings, Hash $deploy_settings = $r10k::params::deploy_settings, + Hash $log_settings = $r10k::params::log_settings, Optional[Array] $postrun = undef, $root_user = $r10k::params::root_user, $root_group = $r10k::params::root_group, diff --git a/manifests/init.pp b/manifests/init.pp index ad0ed1ea..ddcb3f61 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,6 +20,7 @@ Hash $git_settings = $r10k::params::git_settings, Hash $forge_settings = $r10k::params::forge_settings, Hash $deploy_settings = $r10k::params::deploy_settings, + Hash $log_settings = $r10k::params::log_settings, $root_user = $r10k::params::root_user, Optional[String[1]] $proxy = $r10k::params::proxy, Optional[Integer[1]] $pool_size = $r10k::params::pool_size, @@ -69,6 +70,7 @@ git_settings => $git_settings, forge_settings => $forge_settings, deploy_settings => $deploy_settings, + log_settings => $log_settings, postrun => $postrun, root_user => $root_user, root_group => $root_group, diff --git a/manifests/params.pp b/manifests/params.pp index 584b64de..0f8bda09 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -32,6 +32,7 @@ $git_settings = {} $forge_settings = {} $deploy_settings = {} + $log_settings = {} # Git configuration $git_server = $settings::ca_server #lint:ignore:top_scope_facts $repo_path = '/var/repos' diff --git a/templates/r10k.yaml.erb b/templates/r10k.yaml.erb index c2cc81dc..e4877556 100644 --- a/templates/r10k.yaml.erb +++ b/templates/r10k.yaml.erb @@ -39,3 +39,6 @@ <% if @pool_size -%> :pool_size: <%= @pool_size %> <% end -%> +<% if !@log_settings.empty? -%> +<%= settings_to_yaml('logging', @log_settings) %> +<% end -%>