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

Use a space-separated in timesyncd.conf #50

Merged
merged 2 commits into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ It is possible to configure the default ntp servers in /etc/systemd/timesyncd.co
```puppet
class{'::systemd':
$manage_timesyncd => true,
$ntp_server => '0.pool.ntp.org,1.pool.ntp.org',
$fallback_ntp_server => '2.pool.ntp.org,3.pool.ntp.org',
$ntp_server => '0.pool.ntp.org 1.pool.ntp.org',
$fallback_ntp_server => '2.pool.ntp.org 3.pool.ntp.org',
Copy link
Member

Choose a reason for hiding this comment

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

How about passing an array instead?

Copy link
Contributor Author

@hfm hfm Nov 22, 2017

Choose a reason for hiding this comment

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

$ntp_server and $fallback_ntp_server in systemd class now don't allow Array: https://github.com/camptocamp/puppet-systemd/blob/1.1.0/manifests/init.pp#L43-L44

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, it's better that systemd class allow $ntp_server and $ntp_fallback_server to use both Array and String. If you're okay, I'll do.

Copy link
Member

Choose a reason for hiding this comment

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

Oh ok. That's weird, cause the timesyncd class accepts arrays. @bastelfreak you originally wrote that class, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like an oversight and init.pp should match the types of timesyncd.pp

Copy link
Member

Choose a reason for hiding this comment

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

spaces are correct, not sure how I missed it. @hfm can you also allow array as datatype in the init.pp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay i'll change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it by 2c38f1a

}
```

Expand Down
6 changes: 3 additions & 3 deletions manifests/timesyncd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The state that the ``networkd`` service should be in
#
# @param $ntp_server
# comma separated list of ntp servers, will be combined with interface specific
# A space-separated list of NTP servers, will be combined with interface specific
# addresses from systemd-networkd. requires puppetlabs-inifile
#
# @param fallback_ntp_server
Expand Down Expand Up @@ -36,7 +36,7 @@
if $ntp_server =~ String {
$_ntp_server = $ntp_server
} else {
$_ntp_server = join($ntp_server, ',')
$_ntp_server = join($ntp_server, ' ')
}
ini_setting{'ntp_server':
ensure => 'present',
Expand All @@ -52,7 +52,7 @@
if $fallback_ntp_server =~ String {
$_fallback_ntp_server = $fallback_ntp_server
} else {
$_fallback_ntp_server = join($fallback_ntp_server, ',')
$_fallback_ntp_server = join($fallback_ntp_server, ' ')
}
ini_setting{'fallback_ntp_server':
ensure => 'present',
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
context 'when enabling timesyncd with NTP values' do
let(:params) {{
:manage_timesyncd => true,
:ntp_server => '0.pool.ntp.org,1.pool.ntp.org',
:fallback_ntp_server => '2.pool.ntp.org,3.pool.ntp.org'
:ntp_server => '0.pool.ntp.org 1.pool.ntp.org',
:fallback_ntp_server => '2.pool.ntp.org 3.pool.ntp.org'
}}
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_ini_setting('ntp_server')}
Expand Down