Skip to content

Commit

Permalink
Remove Foreman repository parameters
Browse files Browse the repository at this point in the history
This prefers that the Foreman class repo is used. The benefit is that a
user doesn't end up with effectively the same repository twice. Once
named foreman and once foreman_proxy, but pointing to the same URL.

To keep the order consistent, it does collect the anchor that
foreman::repo has which guarantees that the repo is set up before
packages are installed.
  • Loading branch information
ekohl committed May 11, 2021
1 parent 37c8d06 commit 91c2ab1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
8 changes: 2 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@
#
# === 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 @@ -286,8 +282,6 @@
# $puppetca_certificate:: Token-whitelisting only: Certificate to use when encrypting tokens (undef to use SSL certificate)
#
class foreman_proxy (
Optional[String] $repo = $foreman_proxy::params::repo,
Boolean $gpgcheck = $foreman_proxy::params::gpgcheck,
String $version = $foreman_proxy::params::version,
Enum['latest', 'present', 'installed', 'absent'] $ensure_packages_version = $foreman_proxy::params::ensure_packages_version,
Variant[Array[String], String] $bind_host = $foreman_proxy::params::bind_host,
Expand Down Expand Up @@ -432,6 +426,8 @@
contain foreman_proxy::service
contain foreman_proxy::register

Anchor <| title == 'foreman::repo' |> ~> Class['foreman_proxy::install']

# lint:ignore:spaceship_operator_without_tag
Class['foreman_proxy::install']
~> Class['foreman_proxy::config']
Expand Down
14 changes: 0 additions & 14 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# @summary Install the foreman proxy
# @api private
class foreman_proxy::install {
if $foreman_proxy::repo {
foreman::repos { 'foreman_proxy':
repo => $foreman_proxy::repo,
gpgcheck => $foreman_proxy::gpgcheck,
before => Package['foreman-proxy'],
}
}

package {'foreman-proxy':
ensure => $foreman_proxy::version,
}
Expand All @@ -17,16 +9,10 @@
package { 'foreman-proxy-journald':
ensure => installed,
}
if $foreman_proxy::repo {
Foreman::Repos['foreman_proxy'] -> Package['foreman-proxy-journald']
}
}

if $foreman_proxy::register_in_foreman {
contain 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
13 changes: 13 additions & 0 deletions spec/classes/foreman_proxy__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,19 @@
end
end
end

context 'with foreman::repo included' do
let(:pre_condition) do
<<-PUPPET
class { 'foreman::repo':
repo => 'nightly',
}
PUPPET
end

it { should compile.with_all_deps }
it { should contain_package('foreman-proxy').that_requires('Anchor[foreman::repo]') }
end
end
end
end

0 comments on commit 91c2ab1

Please sign in to comment.