Skip to content

Commit

Permalink
yum::copr: add manage_prereq_plugin parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
olifre committed Jun 25, 2023
1 parent 903ebac commit 3f1d236
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
13 changes: 11 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,21 +403,30 @@ yum::copr { 'copart/restic':
The following parameters are available in the `yum::copr` defined type:

* [`copr_repo`](#-yum--copr--copr_repo)
* [`manage_prereq_plugin`](#-yum--copr--manage_prereq_plugin)
* [`ensure`](#-yum--copr--ensure)

##### <a name="-yum--copr--copr_repo"></a>`copr_repo`

Data type: `String`

name of repository, defaults to title
Name of repository, defaults to title.

Default value: `$title`

##### <a name="-yum--copr--manage_prereq_plugin"></a>`manage_prereq_plugin`

Data type: `Boolean`

Wheter required plugin for dnf/yum should be installed by this resource.

Default value: `true`

##### <a name="-yum--copr--ensure"></a>`ensure`

Data type: `Enum['enabled', 'disabled', 'removed']`

specifies if repo should be enabled, disabled or removed
Specifies if repo should be enabled, disabled or removed.

Default value: `'enabled'`

Expand Down
17 changes: 12 additions & 5 deletions manifests/copr.pp
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#
# @summary This definition manages Copr (Cool Other Package Repo) repositories.
#
# @param copr_repo name of repository, defaults to title
# @param ensure specifies if repo should be enabled, disabled or removed
# @param copr_repo
# Name of repository, defaults to title.
# @param manage_prereq_plugin
# Wheter required plugin for dnf/yum should be installed by this resource.
# @param ensure
# Specifies if repo should be enabled, disabled or removed.
#
# @example add and enable COPR restic repository
# yum::copr { 'copart/restic':
# ensure => 'enabled',
# }
#
define yum::copr (
String $copr_repo = $title,
Enum['enabled', 'disabled', 'removed'] $ensure = 'enabled',
String $copr_repo = $title,
Boolean $manage_prereq_plugin = true,
Enum['enabled', 'disabled', 'removed'] $ensure = 'enabled',
) {
$prereq_plugin = $facts['package_provider'] ? {
'dnf' => 'dnf-plugins-core',
default => 'yum-plugin-copr',
}
stdlib::ensure_packages([$prereq_plugin])
if $manage_prereq_plugin {
stdlib::ensure_packages([$prereq_plugin])
}

if $facts['package_provider'] == 'dnf' {
case $ensure {
Expand Down

0 comments on commit 3f1d236

Please sign in to comment.