From c8e8b7845d0fd82fc65481f054d4e1ce7b2e5f90 Mon Sep 17 00:00:00 2001 From: Ralf Bosz Date: Tue, 19 Sep 2023 09:46:03 +0200 Subject: [PATCH] Add the option display_name to template To force the hostname used with Insights add the option display_name in the template --- manifests/current.pp | 27 +++++++++++--------- manifests/init.pp | 30 ++++++++++++++--------- manifests/old.pp | 29 ++++++++++++---------- templates/redhat-access-insights.conf.erb | 8 +++--- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/manifests/current.pp b/manifests/current.pp index ba41bad..2012a91 100644 --- a/manifests/current.pp +++ b/manifests/current.pp @@ -28,6 +28,8 @@ # Whether to obfuscate IP addresses. # @param obfuscate_hostname # Whether to obfuscate hostname. +# @param display_name +# Display name for this system. # # @author Lindani Phiri # @author Dan Varga @@ -35,19 +37,20 @@ # Copyright 2015 Red Hat Inc. # class access_insights_client::current ( - $package_name = 'insights-client', + String $package_name = 'insights-client', Optional[Enum['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']] $log_level = undef, - $auto_config = 'True', - $authmethod = undef, - $username = undef, - $password = undef, - $base_url = undef, - $proxy = undef, - $cert_verify = undef, - $gpg = undef, - $auto_update = undef, - $obfuscate = undef, - $obfuscate_hostname = undef, + Boolean $auto_config = 'True', + Optional[Enum['BASIC','CERT']] $authmethod = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, + Optional[Stdlib::Fqdn] $base_url = undef, + Optional[Stdlib::HTTPUrl] $proxy = undef, + Optional[Boolean] $cert_verify = undef, + Optional[Boolean] $gpg = undef, + Optional[Boolean] $auto_update = undef, + Optional[Boolean] $obfuscate = undef, + Optional[Boolean] $obfuscate_hostname = undef, + Stdlib::Host $display_name = undef, ) { package { $package_name: ensure => installed, diff --git a/manifests/init.pp b/manifests/init.pp index 44ea919..7d3fda3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,6 +2,8 @@ # The access insights module is intended to deploy and configure the Red Hat # Access Insights client. # +# @param package_name +# Name of the package to install. # @param log_level # Change log level, valid options DEBUG, INFO, WARNING, ERROR, CRITICAL. # @param auto_config @@ -30,6 +32,8 @@ # @param deployment_style # How the module should be deploy. Can be undef (auto), # current (6.10+ or 7.5+) or old. +# @param display_name +# Display name for the client. # # @author Lindani Phiri # @author Dan Varga @@ -37,18 +41,20 @@ # Copyright 2015 Red Hat Inc. # class access_insights_client ( + String $package_name = 'insights-client', Optional[Enum['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']] $log_level = undef, - $auto_config = 'True', - $authmethod = undef, - $username = undef, - $password = undef, - $base_url = undef, - $proxy = undef, - $cert_verify = undef, - $gpg = undef, - $auto_update = undef, - $obfuscate = undef, - $obfuscate_hostname = undef, + Boolean $auto_config = 'True', + Optional[Enum['BASIC','CERT']] $authmethod = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, + Optional[Stdlib::Fqdn] $base_url = undef, + Optionla[Stdlib::HTTPUrl] $proxy = undef, + Optional[Boolean] $cert_verify = undef, + Optional[Boolean] $gpg = undef, + Optional[Boolean] $auto_update = undef, + Optional[Boolean] $obfuscate = undef, + Optional[Boolean] $obfuscate_hostname = undef, + Optional[Stdlib::Host] $display_name = undef, Optional[Enum['current', 'old']] $deployment_style = undef, ) { if $deployment_style { @@ -63,6 +69,7 @@ } class { "access_insights_client::${class_name}": + package_name => $package_name, log_level => $log_level, auto_config => $auto_config, authmethod => $authmethod, @@ -75,6 +82,7 @@ auto_update => $auto_update, obfuscate => $obfuscate, obfuscate_hostname => $obfuscate_hostname, + display_name => $display_name, } contain "access_insights_client::${class_name}" } diff --git a/manifests/old.pp b/manifests/old.pp index a2eab1d..8df57ec 100644 --- a/manifests/old.pp +++ b/manifests/old.pp @@ -29,6 +29,8 @@ # Whether to obfuscate IP addresses. # @param obfuscate_hostname # Whether to obfuscate hostname. +# @param display_name +# Display name for this system. # # @author Lindani Phiri # @author Dan Varga @@ -36,19 +38,20 @@ # Copyright 2015 Red Hat Inc. # class access_insights_client::old ( - $package_name = 'redhat-access-insights', - $log_level = undef, - $auto_config = 'True', - $authmethod = undef, - $username = undef, - $password = undef, - $base_url = undef, - $proxy = undef, - $cert_verify = undef, - $gpg = undef, - $auto_update = undef, - $obfuscate = undef, - $obfuscate_hostname = undef, + String $package_name = 'insights-client', + Optional[Enum['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']] $log_level = undef, + Boolean $auto_config = 'True', + Optional[Enum['BASIC','CERT']] $authmethod = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, + Optional[Stdlib::Fqdn] $base_url = undef, + Optional[Stdlib::HTTPUrl] $proxy = undef, + Optional[Boolean] $cert_verify = undef, + Optional[Boolean] $gpg = undef, + Optional[Boolean] $auto_update = undef, + Optional[Boolean] $obfuscate = undef, + Optional[Boolean] $obfuscate_hostname = undef, + Optional[Stdlib::Host] $display_name = undef, ) { package { $package_name: ensure => installed, diff --git a/templates/redhat-access-insights.conf.erb b/templates/redhat-access-insights.conf.erb index f5771bf..ed5f887 100644 --- a/templates/redhat-access-insights.conf.erb +++ b/templates/redhat-access-insights.conf.erb @@ -48,8 +48,6 @@ obfuscate=<%= @obfuscate %> obfuscate_hostname=<%= @obfuscate_hostname %> <%- end -%> - - - - - +<%- if @display_name -%> +display_name=<%= @display_name %> +<%- end -%>