Permalink
Browse files

Code style fixes

  • Loading branch information...
arioch committed Nov 22, 2012
1 parent fda193e commit 3bb4ead3422f7308f46d7a36f089bff7f9a905b7
Showing with 77 additions and 89 deletions.
  1. +19 −16 README.md
  2. +10 −6 manifests/config.pp
  3. +7 −60 manifests/init.pp
  4. +4 −3 manifests/params.pp
  5. +36 −0 manifests/rule.pp
  6. +1 −4 templates/rule.conf.erb
View
@@ -1,20 +1,23 @@
-## Sample usage
+# Puppet Ulimit
- node host01 {
- class { 'ulimit': }
+## Requirements
- ulimit::rule {
- 'foo1':
- ensure => present,
- ulimit_domain => 'domain',
- ulimit_type => 'type',
- ulimit_item => 'item',
- ulimit_value => 'value',
- 'foo2':
- ensure => present,
- ulimit_domain => 'domain',
- ulimit_type => 'type',
- ulimit_item => 'item',
- ulimit_value => 'value',
+## Tested on...
+
+* Debian 5 (Lenny)
+* Debian 6 (Squeeze)
+
+## Example usage
+
+ node /box/ {
+ include ulimit
+
+ ulimit::rule { 'foo1':
+ ensure => present,
+ ulimit_domain => 'domain',
+ ulimit_type => 'type',
+ ulimit_item => 'item',
+ ulimit_value => 'value',
}
}
+
View
@@ -1,11 +1,15 @@
# Class: ulimit::config
#
-#
class ulimit::config {
- file {
- $ulimit::params::ulimit_confdir:
- ensure => directory,
- recurse => true,
- purge => true;
+ File {
+ group => $::ulimit::config_group,
+ owner => $::ulimit::config_user,
+ }
+
+ file { $::ulimit::config_dir:
+ ensure => directory,
+ recurse => true,
+ purge => true;
}
}
+
View
@@ -1,65 +1,12 @@
# Class: ulimit
#
-# This class installs ulimit
-#
-# Parameters:
-#
-# Actions:
-# - Install ulimit
-#
-# Requires:
-#
-# Sample Usage:
-# node host01 {
-# class { 'ulimit': }
-#
-# ulimit::rule {
-# 'foo1':
-# ensure => present,
-# ulimit_domain => 'domain',
-# ulimit_type => 'type',
-# ulimit_item => 'item',
-# ulimit_value => 'value',
-# 'foo2':
-# ensure => present,
-# ulimit_domain => 'domain',
-# ulimit_type => 'type',
-# ulimit_item => 'item',
-# ulimit_value => 'value',
-# }
-# }
-#
-class ulimit {
- class { 'ulimit::params': }
- class { 'ulimit::config': }
-
- Class['ulimit::params'] ->
- Class['ulimit::config']
+class ulimit (
+ $config_dir = $ulimit::params::config_dir,
+ $config_group = $ulimit::params::config_group,
+ $config_user = $ulimit::params::config_user
+) inherits ulimit::params {
- # Define: rule
- # Parameters:
- # $ensure, $ulimit_domain, $ulimit_type, $ulimit_item, $ulimit_value
- #
- define rule ( $ensure, $ulimit_domain, $ulimit_type, $ulimit_item, $ulimit_value ) {
- case $ensure {
- 'present': {
- file {
- "$ulimit::params::ulimit_confdir/${name}.conf":
- ensure => file,
- content => template ('ulimit/rule.conf.erb');
- }
- }
+ include ulimit::config
- 'absent': {
- file {
- "$ulimit::params::ulimit_confdir/${name}":
- ensure => absent;
- }
- }
-
- default: {
- fail 'No ensure value found for ulimit rule.'
- }
- }
- }
}
+
View
@@ -1,7 +1,8 @@
# Class: ulimit::params
#
-#
class ulimit::params {
- $ulimit_name = 'ulimit'
- $ulimit_confdir = '/etc/security/limits.d'
+ $config_dir = '/etc/security/limits.d'
+ $config_group = 'root'
+ $config_user = 'root'
}
+
View
@@ -0,0 +1,36 @@
+# Define: rule
+#
+define ulimit::rule (
+ $ulimit_domain,
+ $ulimit_type,
+ $ulimit_item,
+ $ulimit_value,
+ $ensure = present,
+) {
+ File {
+ group => $::ulimit::config_group,
+ owner => $::ulimit::config_user,
+ }
+
+ case $ensure {
+ 'present': {
+ file {
+ "${::ulimit::config_dir}/${name}.conf":
+ ensure => $ensure,
+ content => template ('ulimit/rule.conf.erb');
+ }
+ }
+
+ 'absent': {
+ file {
+ "${::ulimit::config_dir}/${name}":
+ ensure => $ensure;
+ }
+ }
+
+ default: {
+ fail 'No ensure value found for ulimit rule.'
+ }
+ }
+}
+
View
@@ -1,7 +1,4 @@
-#
-# File managed by Puppet
-#
-
# <domain> <type> <item> <value>
#
+
<%= ulimit_domain %> <%= ulimit_type %> <%= ulimit_item %> <%= ulimit_value %>

0 comments on commit 3bb4ead

Please sign in to comment.