Skip to content
Draft
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Preliminary FreeBSD support (no acceptance testing, ouch).

## [0.11.0] - 2024-08-01
### Changed
Expand Down
4 changes: 4 additions & 0 deletions data/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
cron::root_group: wheel
cron::manage_package: false
...
13 changes: 13 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
version: 5

defaults:
datadir: data
data_hash: yaml_data

hierarchy:
- name: Operating System Family
path: '%{facts.os.family}.yaml'
- name: Common Configuration
path: common.yaml
...
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
default:
force => true,
owner => 'root',
group => 'root',
group => $cron::root_group,
mode => '0644';
'/etc/cron.allow':
ensure => if (!$cron::allow_all_users and empty($cron::denied_users)) { file } else { absent },
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
# }
#
# @param ensure Whether to enable or disable cron on the system.
# @param manage_package Whether to manage cron package on the system.
# @param package_version Custom `cron` package version.
# @param root_group Name of the root group.
# @param allow_all_users Allow all users to manage crontab.
# @param allowed_users List of users allowed to use `crontab(1)`. By default, only root can.
# @param denied_users List of users specifically denied to use `crontab(1)`.
Expand All @@ -38,9 +40,11 @@
Enum[present, absent] $ensure = present,

# cron::install
Boolean $manage_package = true,
Pattern[/\A[^\n]+\z/] $package_version = installed,

# cron::config
Pattern[/\A[^\n]+\z/] $root_group = 'root',
Boolean $allow_all_users = false,
Array[Cron::User] $allowed_users = [],
Array[Cron::User] $denied_users = [],
Expand Down
6 changes: 4 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#
# @api private
class cron::install {
package { 'cron':
ensure => $cron::package_version,
if $cron::manage_package {
package { 'cron':
ensure => $cron::package_version,
}
}
}
7 changes: 7 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
}
],
"operatingsystem_support": [
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"13",
"14"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/cron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
it { is_expected.to contain_class('cron::service') }

describe 'cron::install' do
it { is_expected.to contain_package('cron').with_ensure(:installed) }
on_supported_os.each do |os_name, facts|
context "on #{os_name}" do
let(:facts) { facts }

it { is_expected.to contain_package('cron').with_ensure(:installed) }
end
end
end

describe 'cron::config' do
Expand Down