-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #29602 - Refactor repository handling
This removes the repo parameters from the main class, in favor of a standalone class that can be included. It uses an anchor because that can be collected in the main class to keep the correct dependency chaining while using composition.
- Loading branch information
Showing
13 changed files
with
90 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
# @summary Configure the foreman repo | ||
# @api private | ||
# Configure the foreman repo | ||
# | ||
# @param repo | ||
# The repository version to manage. This can be a specific version or nightly | ||
# | ||
# @param configure_scl_repo | ||
# If disabled the SCL repo will not be configured on Red Hat clone systems. | ||
# (Currently only installs repos for CentOS and Scientific) | ||
# | ||
# @param gpgcheck | ||
# Turn on/off gpg check in repo files (effective only on RedHat family systems) | ||
# | ||
# @param scl_repo_ensure | ||
# The ensure to set on the SCL repo package | ||
# | ||
class foreman::repo( | ||
$repo = $foreman::repo, | ||
$gpgcheck = $foreman::gpgcheck, | ||
$configure_epel_repo = $foreman::configure_epel_repo, | ||
$configure_scl_repo = $foreman::configure_scl_repo, | ||
Optional[Variant[Enum['nightly'], Pattern['^\d+\.\d+$']]] $repo = undef, | ||
Boolean $gpgcheck = true, | ||
Boolean $configure_scl_repo = $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7', | ||
String $scl_repo_ensure = 'installed', | ||
) { | ||
if $repo { | ||
foreman::repos { 'foreman': | ||
repo => $repo, | ||
gpgcheck => $gpgcheck, | ||
before => Class['foreman::repos::extra'], | ||
before => Anchor['foreman::repo'], | ||
} | ||
|
||
if $configure_scl_repo { | ||
Foreman::Repos['foreman'] -> Package['foreman-release-scl'] | ||
} | ||
} | ||
|
||
class { 'foreman::repos::extra': | ||
configure_epel_repo => $configure_epel_repo, | ||
configure_scl_repo => $configure_scl_repo, | ||
if $configure_scl_repo { | ||
package {'foreman-release-scl': | ||
ensure => $scl_repo_ensure, | ||
before => Anchor['foreman::repo'], | ||
} | ||
} | ||
contain foreman::repos::extra | ||
|
||
# An anchor is used because it can be collected | ||
anchor { 'foreman::repo': } # lint:ignore:anchor_resource | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
475afc0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit made it impossible to disable repository-handling by the module. For some environments, we're unable to gather packages from the proposed upstream repository and need to configure trusted mirrors.
Could you please add a small follow-up switch to disable repository-handling? The way it currently exists, breaks some of our setups.
475afc0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you're asking. Just don't include the class
foreman:;repo
to disable the handling. And the repo classes never had anything to ensure repos were absent.Comments on individual commits tend to get lost so please open an issue or PR with a reproducer for what you're trying to achieve.