Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced default configuration #194

Merged
merged 7 commits into from
Nov 19, 2015
Merged
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
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Would you consider it backwards-incompatible to start managing this file? Anyone with keys already would get them wiped out when upgrading to this version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've assumed the file being managed previously (which is now being corrected). So indeed it actually is backwards incompatible. But we aren't replacing the keys file here (don't see a file or template directive), only modifying the owner/group/permission set, so it seems trivial to me?

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