Skip to content

Commit

Permalink
Merge pull request #216 from markt-de/add_ensure
Browse files Browse the repository at this point in the history
add $ensure parameter for all package operations
  • Loading branch information
smortex authored Jan 10, 2025
2 parents f7e03b4 + 5456e1c commit 904a361
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
27 changes: 27 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ The following parameters are available in the `bacula::client` class:

* [`messages`](#-bacula--client--messages)
* [`packages`](#-bacula--client--packages)
* [`ensure`](#-bacula--client--ensure)
* [`services`](#-bacula--client--services)
* [`default_pool`](#-bacula--client--default_pool)
* [`default_pool_full`](#-bacula--client--default_pool_full)
Expand Down Expand Up @@ -298,6 +299,14 @@ Data type: `Array[String[1]]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--client--ensure"></a>`ensure`

Data type: `String[1]`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--client--services"></a>`services`

Data type: `String[1]`
Expand Down Expand Up @@ -499,6 +508,7 @@ The following parameters are available in the `bacula::director` class:

* [`messages`](#-bacula--director--messages)
* [`packages`](#-bacula--director--packages)
* [`ensure`](#-bacula--director--ensure)
* [`services`](#-bacula--director--services)
* [`manage_db`](#-bacula--director--manage_db)
* [`conf_dir`](#-bacula--director--conf_dir)
Expand Down Expand Up @@ -533,6 +543,14 @@ Data type: `Array[String[1]]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--director--ensure"></a>`ensure`

Data type: `String[1]`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--director--services"></a>`services`

Data type: `String[1]`
Expand Down Expand Up @@ -760,6 +778,7 @@ The following parameters are available in the `bacula::storage` class:

* [`services`](#-bacula--storage--services)
* [`packages`](#-bacula--storage--packages)
* [`ensure`](#-bacula--storage--ensure)
* [`conf_dir`](#-bacula--storage--conf_dir)
* [`device`](#-bacula--storage--device)
* [`device_mode`](#-bacula--storage--device_mode)
Expand Down Expand Up @@ -791,6 +810,14 @@ Data type: `Array[String[1]]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--storage--ensure"></a>`ensure`

Data type: `String[1]`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--storage--conf_dir"></a>`conf_dir`

Data type: `Stdlib::Absolutepath`
Expand Down
4 changes: 3 additions & 1 deletion manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# @param messages Logging configuration; loaded from hiera
# @param packages A list of packages to install; loaded from hiera
# @param ensure What state the package should be in.
# @param services A list of services to operate; loaded from hiera
# @param default_pool The name of the Pool for this FD to use by default
# @param default_pool_full The name of the Pool to use for Full jobs
Expand Down Expand Up @@ -59,6 +60,7 @@
Optional[String[1]] $default_pool_full,
Optional[String[1]] $default_pool_inc,
Optional[String[1]] $default_pool_diff,
String[1] $ensure = 'present',
Stdlib::Port $port = 9102,
Array[String[1]] $listen_address = [],
Bacula::Password $password = 'secret',
Expand All @@ -80,7 +82,7 @@
$config_file = "${conf_dir}/bacula-fd.conf"

package { $packages:
ensure => present,
ensure => $ensure,
}

service { $services:
Expand Down
4 changes: 3 additions & 1 deletion manifests/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# @param messages Logging configuration; loaded from hiera
# @param packages A list of packages to install; loaded from hiera
# @param ensure What state the package should be in.
# @param services A list of services to operate; loaded from hiera
# @param manage_db Whether the module should manage the director database
# @param conf_dir Path to bacula configuration directory
Expand Down Expand Up @@ -39,6 +40,7 @@
Array[String[1]] $packages,
String[1] $services,
String[1] $make_bacula_tables,
String[1] $ensure = 'present',
Bacula::Yesno $manage_db = true,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
String[1] $db_name = 'bacula',
Expand Down Expand Up @@ -85,7 +87,7 @@
}
)
}
ensure_packages($package_names)
ensure_packages($package_names, { ensure => $ensure })

service { $services:
ensure => running,
Expand Down
4 changes: 3 additions & 1 deletion manifests/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# @param services A list of services to operate; loaded from hiera
# @param packages A list of packages to install; loaded from hiera
# @param ensure What state the package should be in.
# @param conf_dir Path to bacula configuration directory
# @param device The system file name of the storage device managed by this storage daemon
# @param device_mode The posix mode for device
Expand All @@ -27,6 +28,7 @@
class bacula::storage (
String[1] $services,
Array[String[1]] $packages,
String[1] $ensure = 'present',
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
Stdlib::Absolutepath $device = '/bacula',
Stdlib::Filemode $device_mode = '0770',
Expand Down Expand Up @@ -54,7 +56,7 @@
}
)
}
ensure_packages($package_names)
ensure_packages($package_names, { ensure => $ensure })

service { $services:
ensure => running,
Expand Down

0 comments on commit 904a361

Please sign in to comment.