diff options
author | intrigeri <intrigeri@boum.org> | 2012-11-09 21:54:58 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2012-11-11 17:47:24 +0100 |
commit | 49cb5faa62544c589a82b9d48a768eb1391c9a61 (patch) | |
tree | 1ebac38338ae392ea7cdd72b902aa54e1cbab383 /manifests | |
parent | 3a91fa40e19ab0645e159e76592fcbe60fc8ea41 (diff) | |
download | puppet-tor-49cb5faa62544c589a82b9d48a768eb1391c9a61.tar.gz puppet-tor-49cb5faa62544c589a82b9d48a768eb1391c9a61.tar.bz2 |
Migrate to parameterized classes, drop global variables.
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/daemon.pp | 28 | ||||
-rw-r--r-- | manifests/init.pp | 9 | ||||
-rw-r--r-- | manifests/torsocks.pp | 7 |
3 files changed, 22 insertions, 22 deletions
diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 06a396b..9351b3c 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -1,8 +1,12 @@ -class tor::daemon inherits tor { - - # config variables - $data_dir = '/var/lib/tor' - $config_file = '/etc/tor/torrc' +class tor::daemon ( + $data_dir = '/var/lib/tor', + $config_file = '/etc/tor/torrc', + $use_bridges = 0, + $automap_hosts_on_resolve = 0, + $log_rules = [ 'notice file /var/log/tor/notices.log' ], +) inherits tor { + + # constants $spool_dir = '/var/lib/puppet/modules/tor' $snippet_dir = "${spool_dir}/torrc.d" @@ -74,16 +78,10 @@ class tor::daemon inherits tor { } # global configurations - define global_opts( $data_dir = $tor::daemon::data_dir, - $log_rules = [ 'notice file /var/log/tor/notices.log' ], - $use_bridges = 0, - $automap_hosts_on_resolve = 0) { - - concatenated_file_part { '01.global': - dir => $tor::daemon::snippet_dir, - content => template('tor/torrc.global.erb'), - owner => 'debian-tor', group => 'debian-tor', mode => 0644, - } + concatenated_file_part { '01.global': + dir => $snippet_dir, + content => template('tor/torrc.global.erb'), + owner => 'debian-tor', group => 'debian-tor', mode => 0644, } # socks definition diff --git a/manifests/init.pp b/manifests/init.pp index d916188..613eb29 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,10 @@ -class tor { +class tor ( + $ensure_version = 'installed', + $use_munin = false, +){ - if !$tor_ensure_version { $tor_ensure_version = 'installed' } - package { [ "tor", "tor-geoipdb" ]: - ensure => $tor_ensure_version, + ensure => $ensure_version, } service { 'tor': diff --git a/manifests/torsocks.pp b/manifests/torsocks.pp index 7bb51ee..452b4f1 100644 --- a/manifests/torsocks.pp +++ b/manifests/torsocks.pp @@ -1,7 +1,8 @@ -class tor::torsocks { - if !$torsocks_ensure_version { $torsocks_ensure_version = 'installed' } +class tor::torsocks ( + $ensure_version = 'installed', +){ include ::tor package{'torsocks': - ensure => $torsocks_ensure_version, + ensure => $ensure_version, } } |