Skip to content

Commit

Permalink
Add option to avoid overwriting OS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amiryal committed Mar 15, 2016
1 parent 1ad0c2e commit 5b4e908
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ class { '::logrotate':
}
```

To avoid overwriting the OS-provided main configuration file, set `config` to `false`.

```puppet
class { '::logrotate':
config => false,
}
```


## Examples

Expand Down
11 changes: 7 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
}
}

if is_hash($config) {
$custom_config = {'/etc/logrotate.conf' => $config}
create_resources('logrotate::conf', $custom_config)
if $config {
if is_hash($config) {
$custom_config = {'/etc/logrotate.conf' => $config}
create_resources('logrotate::conf', $custom_config)
}
include ::logrotate::defaults
}

}
}
4 changes: 1 addition & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
$manage_cron_daily = true,
$package = 'logrotate',
$rules = {},
$config = undef,
$config = true,
) {

include ::logrotate::install
include ::logrotate::config
include ::logrotate::defaults
include ::logrotate::rules

anchor{'logrotate_begin':}->
Class['::logrotate::install']->
Class['::logrotate::config']->
Class['::logrotate::defaults']->
Class['::logrotate::rules']->
anchor{'logrotate_end':}

Expand Down

0 comments on commit 5b4e908

Please sign in to comment.