Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Hiera-based parameter data #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
earlyoom::avoid: NULL
earlyoom::config::avoid: "%{alias('earlyoom::avoid')}"
earlyoom::config::configfile: "%{alias('earlyoom::configfile')}"
earlyoom::config::debug: "%{alias('earlyoom::debug')}"
earlyoom::config::dryrun: "%{alias('earlyoom::dryrun')}"
earlyoom::config::ignore_positive: "%{alias('earlyoom::ignore_positive')}"
earlyoom::config::interval: "%{alias('earlyoom::interval')}"
earlyoom::config::local_user: "%{alias('earlyoom::local_user')}"
earlyoom::config::memory_percent: "%{alias('earlyoom::memory_percent')}"
earlyoom::config::memory_size: "%{alias('earlyoom::memory_size')}"
earlyoom::config::notify_command: "%{alias('earlyoom::notify_command')}"
earlyoom::config::notify_send: "%{alias('earlyoom::notify_send')}"
earlyoom::config::prefer: "%{alias('earlyoom::prefer')}"
earlyoom::config::priority: "%{alias('earlyoom::priority')}"
earlyoom::config::swap_percent: "%{alias('earlyoom::swap_percent')}"
earlyoom::config::swap_size: "%{alias('earlyoom::swap_size')}"
earlyoom::configfile: '/etc/default/earlyoom'
earlyoom::debug: false
earlyoom::dryrun: false
earlyoom::ignore_positive: false
earlyoom::install::pkgname: "%{alias('earlyoom::pkgname')}"
earlyoom::interval: 60
earlyoom::local_user: false
earlyoom::memory_percent: NULL
earlyoom::memory_size: NULL
earlyoom::notify_command: NULL
earlyoom::notify_send: false
earlyoom::pkgname: 'earlyoom'
earlyoom::prefer: NULL
earlyoom::priority: false
earlyoom::service::service_enable: "%{alias('earlyoom::service_enable')}"
earlyoom::service_enable: true
earlyoom::swap_percent: NULL
earlyoom::swap_size: NULL
8 changes: 8 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 5
defaults:
datadir: 'data'
data_hash: yaml_data
hierarchy:
- name: 'Defaults'
path: 'defaults.yaml'
30 changes: 15 additions & 15 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# @api private
#
class earlyoom::config (
$configfile = $earlyoom::configfile,
$interval = $earlyoom::interval,
$ignore_positive = $earlyoom::ignore_positive,
$notify_send = $earlyoom::notify_send,
$debug = $earlyoom::debug,
$priority = $earlyoom::priority,
$prefer = $earlyoom::prefer,
$avoid = $earlyoom::avoid,
$notify_command = $earlyoom::notify_command,
$memory_percent = $earlyoom::memory_percent,
$swap_percent = $earlyoom::swap_percent,
$memory_size = $earlyoom::memory_size,
$swap_size = $earlyoom::swap_size,
$dryrun = $earlyoom::dryrun,
$local_user = $earlyoom::local_user,
$configfile,
$interval,
$ignore_positive,
$notify_send,
$debug,
$priority,
$prefer,
$avoid,
$notify_command,
$memory_percent,
$swap_percent,
$memory_size,
$swap_size,
$dryrun,
$local_user,
) {
assert_private()

Expand Down
35 changes: 17 additions & 18 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,23 @@
# so the dynamic user is not present and the local user can be added.
#
class earlyoom (
String[1] $pkgname = 'earlyoom',
Stdlib::Unixpath $configfile = '/etc/default/earlyoom',
Integer[0] $interval = 60,
Boolean $service_enable = true,
Boolean $ignore_positive = false,
Boolean $notify_send = false,
Boolean $debug = false,
Boolean $priority = false,
Boolean $dryrun = false,
Boolean $local_user = false,
Optional[String[1]] $prefer = undef,
Optional[String[1]] $avoid = undef,
Optional[String[1]] $notify_command = undef,
Optional[Variant[Integer[0,100],Array[Integer[0,100],2,2]]] $memory_percent = undef,
Optional[Variant[Integer[0,100],Array[Integer[0,100],2,2]]] $swap_percent = undef,
Optional[Variant[Integer[0],Array[Integer[0],2,2]]] $memory_size = undef,
Optional[Variant[Integer[0],Array[Integer[0],2,2]]] $swap_size = undef,

String[1] $pkgname,
Stdlib::Unixpath $configfile,
Integer[0] $interval,
Boolean $service_enable,
Boolean $ignore_positive,
Boolean $notify_send,
Boolean $debug,
Boolean $priority,
Boolean $dryrun,
Boolean $local_user,
Optional[String[1]] $prefer,
Optional[String[1]] $avoid,
Optional[String[1]] $notify_command,
Optional[Variant[Integer[0,100],Array[Integer[0,100],2,2]]] $memory_percent,
Optional[Variant[Integer[0,100],Array[Integer[0,100],2,2]]] $swap_percent,
Optional[Variant[Integer[0],Array[Integer[0],2,2]]] $memory_size,
Optional[Variant[Integer[0],Array[Integer[0],2,2]]] $swap_size,
) {
contain 'earlyoom::install'
contain 'earlyoom::config'
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @api private
#
class earlyoom::install (
$pkgname = $earlyoom::pkgname,
$pkgname,
) {
assert_private()

Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @api private
#
class earlyoom::service (
$service_enable = $earlyoom::service_enable,
$service_enable,
) {
assert_private()

Expand Down