Skip to content

Commit

Permalink
Disable repository management by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Dec 17, 2018
1 parent 2973ea9 commit b526c91
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
15 changes: 5 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 6 additions & 9 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -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' {
Expand All @@ -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' {
Expand Down
6 changes: 1 addition & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -167,7 +163,7 @@
$groups = []

# Packaging
$repo = '1.18'
$repo = undef
$gpgcheck = true
$version = 'present'
$ensure_packages_version = 'present'
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# Actual test
class { '::foreman_proxy':
custom_repo => false,
repo => 'nightly',
puppet_group => 'root',
register_in_foreman => false,
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# Actual test
class { '::foreman_proxy':
custom_repo => false,
repo => 'nightly',
puppet_group => 'root',
register_in_foreman => false,
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/foreman_proxy__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b526c91

Please sign in to comment.