From b526c91a9c8a39abf68e56bc9d226c5d46b56bda Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 16 Dec 2018 14:05:26 +0100 Subject: [PATCH] Disable repository management by default Because we're trying to move people away from the latest repository, we set it to configure an explicit version with a default. Because this default would need to be updated all the time, it's a bad idea. This patch removes the $custom_repo and makes $repo undef by default. This means users get no repository by default and need to explicitly choose which repository to use. Because repo management would not be of much interest to installer users, we move it together with $gpgcheck to the advanced section. --- manifests/init.pp | 15 +++++---------- manifests/install.pp | 15 ++++++--------- manifests/params.pp | 6 +----- spec/acceptance/basic_spec.rb | 1 - spec/acceptance/http_spec.rb | 1 - spec/classes/foreman_proxy__spec.rb | 2 ++ 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 33741ebc..f8124bfe 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,14 +2,6 @@ # # === Parameters: # -# $repo:: This can be stable, rc, or nightly -# -# $gpgcheck:: Turn on/off gpg check in repo files (effective only on RedHat family systems) -# -# $custom_repo:: No need to change anything here by default -# if set to true, no repo will be added by this module, letting you to -# set it to some custom location. -# # $version:: foreman package version, it's passed to ensure parameter of package resource # can be set to specific version number, 'latest', 'present' etc. # @@ -289,6 +281,10 @@ # # === Advanced parameters: # +# $repo:: Which repository to use. Can be a specific version or nightly. Will not configure anything when undefined. +# +# $gpgcheck:: Turn on/off gpg check in repo files (effective only on RedHat family systems) +# # $dhcp_failover_address:: Address for DHCP to listen for connections from its peer # # $dhcp_failover_port:: Port for DHCP to listen & communicate with it DHCP peer @@ -316,9 +312,8 @@ # $puppetca_certificate:: Token-whitelisting only: Certificate to use when encrypting tokens (undef to use SSL certificate) # class foreman_proxy ( - String $repo = $::foreman_proxy::params::repo, + Optional[String] $repo = $::foreman_proxy::params::repo, Boolean $gpgcheck = $::foreman_proxy::params::gpgcheck, - Boolean $custom_repo = $::foreman_proxy::params::custom_repo, String $version = $::foreman_proxy::params::version, Enum['latest', 'present', 'installed', 'absent'] $ensure_packages_version = $::foreman_proxy::params::ensure_packages_version, Enum['latest', 'present', 'installed', 'absent'] $plugin_version = $::foreman_proxy::params::plugin_version, diff --git a/manifests/install.pp b/manifests/install.pp index 43ea3ba2..f679d005 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,20 +1,15 @@ # Install the foreman proxy class foreman_proxy::install { - if ! $foreman_proxy::custom_repo { + if $foreman_proxy::repo { foreman::repos { 'foreman_proxy': repo => $foreman_proxy::repo, gpgcheck => $foreman_proxy::gpgcheck, + before => Package['foreman-proxy'], } } - $repo = $foreman_proxy::custom_repo ? { - true => [], - default => Foreman::Repos['foreman_proxy'], - } - package {'foreman-proxy': - ensure => $foreman_proxy::version, - require => $repo, + ensure => $foreman_proxy::version, } if $foreman_proxy::log == 'JOURNALD' { @@ -25,7 +20,9 @@ if $foreman_proxy::register_in_foreman { contain foreman::providers - $repo -> Class['foreman::providers'] + if $foreman_proxy::repo { + Foreman::Repos['foreman_proxy'] -> Class['foreman::providers'] + } } if $foreman_proxy::bmc and $foreman_proxy::bmc_default_provider != 'shell' { diff --git a/manifests/params.pp b/manifests/params.pp index 50273a0f..cd2c74df 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -7,7 +7,6 @@ 'RedHat': { # if set to true, no repo will be added by this module, letting you to # set it to some custom location. - $custom_repo = false $plugin_prefix = 'rubygem-smart_proxy_' $dir = '/usr/share/foreman-proxy' @@ -36,7 +35,6 @@ 'Debian': { # if set to true, no repo will be added by this module, letting you to # set it to some custom location. - $custom_repo = false $plugin_prefix = 'ruby-smart-proxy-' $dir = '/usr/share/foreman-proxy' @@ -72,7 +70,6 @@ /^(FreeBSD|DragonFly)$/: { # if set to true, no repo will be added by this module, letting you to # set it to some custom location. - $custom_repo = true # as foreman packages are in standard FreeBSD ports $plugin_prefix = 'rubygem-smart_proxy_' $dir = '/usr/local/share/foreman-proxy' @@ -107,7 +104,6 @@ 'Archlinux': { # if set to true, no repo will be added by this module, letting you to # set it to some custom location. - $custom_repo = true # package is in the AUR $plugin_prefix = 'ruby-smart-proxy-' $dir = '/usr/share/foreman-proxy' @@ -167,7 +163,7 @@ $groups = [] # Packaging - $repo = '1.18' + $repo = undef $gpgcheck = true $version = 'present' $ensure_packages_version = 'present' diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 69bc39cc..3c0f94fa 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -27,7 +27,6 @@ # Actual test class { '::foreman_proxy': - custom_repo => false, repo => 'nightly', puppet_group => 'root', register_in_foreman => false, diff --git a/spec/acceptance/http_spec.rb b/spec/acceptance/http_spec.rb index df1a1814..1aa9836c 100644 --- a/spec/acceptance/http_spec.rb +++ b/spec/acceptance/http_spec.rb @@ -27,7 +27,6 @@ # Actual test class { '::foreman_proxy': - custom_repo => false, repo => 'nightly', puppet_group => 'root', register_in_foreman => false, diff --git a/spec/classes/foreman_proxy__spec.rb b/spec/classes/foreman_proxy__spec.rb index 91e549fc..12fb5db8 100644 --- a/spec/classes/foreman_proxy__spec.rb +++ b/spec/classes/foreman_proxy__spec.rb @@ -11,6 +11,8 @@ should contain_class('foreman_proxy::service') should contain_class('foreman_proxy::register') end + + it { should_not contain_class('foreman::repo') } end end end