Skip to content

Commit

Permalink
Added $config_dir variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianschauenburg committed Mar 16, 2015
1 parent f14da61 commit 7d8883a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
15 changes: 12 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
class ntp::config inherits ntp {

if $keys_enable {
$directory = ntp_dirname($keys_file)
file { $directory:
file { $keys_file:
ensure => file,
owner => 0,
group => 0,
mode => '0644',
}
}

if $config_dir {
file { $config_dir:
ensure => directory,
owner => 0,
group => 0,
mode => '0755',
mode => '0644',
recurse => false,
}
}

Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
$autoupdate = $ntp::params::autoupdate,
$broadcastclient = $ntp::params::broadcastclient,
$config = $ntp::params::config,
$config_dir = $ntp::params::config_dir,
$config_template = $ntp::params::config_template,
$disable_auth = $ntp::params::disable_auth,
$disable_monitor = $ntp::params::disable_monitor,
Expand Down Expand Up @@ -56,6 +57,10 @@
validate_string($service_name)
validate_bool($udlc)

if $config_dir {
validate_absolute_path($config_dir)
}

if $autoupdate {
notice('autoupdate parameter has been deprecated and replaced with package_ensure. Set this to latest for the same behavior as autoupdate => true.')
}
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class ntp::params {

$autoupdate = false
$config_dir = undef
$config_template = 'ntp/ntp.conf.erb'
$disable_monitor = false
$keys_enable = false
Expand Down
6 changes: 0 additions & 6 deletions spec/classes/ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
:keys_requestkey => '3',
}}

it { should contain_file('/etc/ntp').with({
'ensure' => 'directory'})
}
it { should contain_file('/etc/ntp.conf').with({
'content' => /trustedkey 1 2 3/})
}
Expand All @@ -69,9 +66,6 @@
:keys_requestkey => '3',
}}

it { should_not contain_file('/etc/ntp').with({
'ensure' => 'directory'})
}
it { should_not contain_file('/etc/ntp.conf').with({
'content' => /trustedkey 1 2 3/})
}
Expand Down

0 comments on commit 7d8883a

Please sign in to comment.