From 5fccecf753bed3a1ee8d481a1e0a7e7da3510094 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 5 Nov 2016 16:34:28 +0100 Subject: [PATCH 1/4] make sure we iterate predictable over the hash a hash is not guaranteed to be ordered, especially not always in the same way. So to avoid flipping on the server we should sort the keys so the output always looks the same. --- templates/chrony.conf.archlinux.erb | 4 ++-- templates/chrony.conf.redhat.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/chrony.conf.archlinux.erb b/templates/chrony.conf.archlinux.erb index c757e98..61b415e 100644 --- a/templates/chrony.conf.archlinux.erb +++ b/templates/chrony.conf.archlinux.erb @@ -46,8 +46,8 @@ ! server ntp0.your-isp.com ! server ntp1.your-isp.com ! server ntp.public-server.org -<% if @servers.is_a?(Hash) then @servers.each do |server, options| -%> -server <%= server %> <%= options.join(' ') %> +<% if @servers.is_a?(Hash) then @servers.keys.sort.each do |server| -%> +server <%= server %> <%= @servers[server].join(' ') %> <% end else Array(@servers).each do |server| -%> server <%= server %> iburst <% end end -%> diff --git a/templates/chrony.conf.redhat.erb b/templates/chrony.conf.redhat.erb index 97836d6..366baf9 100644 --- a/templates/chrony.conf.redhat.erb +++ b/templates/chrony.conf.redhat.erb @@ -1,7 +1,7 @@ # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). -<% if @servers.is_a?(Hash) then @servers.each do |server, options| -%> -server <%= server %> <%= options.join(' ') %> +<% if @servers.is_a?(Hash) then @servers.keys.sort.each do |server| -%> +server <%= server %> <%= @servers[server].join(' ') %> <% end else Array(@servers).each do |server| -%> server <%= server %> iburst <% end end -%> From 51d7a4de9d9a11f58497dd0ad8ac2162642a60e6 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Nov 2016 11:59:56 +0100 Subject: [PATCH 2/4] make it work with 1.9.3 --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 5c79c61..77f8fc1 100644 --- a/Gemfile +++ b/Gemfile @@ -11,3 +11,7 @@ gem 'puppet-lint', '>=0.3.2' gem 'puppetlabs_spec_helper', '>=0.2.0' gem 'rake', '>=0.9.2.2' gem 'librarian-puppet', '>=1.0.0' + +if RUBY_VERSION.to_i < 2.0 + gem 'json_pure', '< 2.0.2' +end From b970c56ad40104bc59cdca6ee8e808c17ab2c14d Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Nov 2016 12:05:23 +0100 Subject: [PATCH 3/4] newer puppet versions are more strict with unknown facts --- spec/classes/init_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9bae8b0..0323d7d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -94,9 +94,14 @@ }.to raise_error(/Setting \$config_keys_manage false and \$chrony_password at same time in chrony is not possible\./) } end context 'on any other system' do + let(:facts){ + { + :osfamily => 'Debian', + } + } it { expect { should compile - }.to raise_error(/The chrony module is not supported on an based system\./) } + }.to raise_error(/The chrony module is not supported on an Debian based system\./) } end end From 60bbdb3af9b2b200319fe4c572966d3b5e9d4a4c Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Nov 2016 12:13:11 +0100 Subject: [PATCH 4/4] test with latest 3.x puppet version --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3445216..4dc49e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ matrix: fast_finish: true include: - rvm: 1.9.3 - env: PUPPET_VERSION=3.7.4 + env: PUPPET_VERSION=3.8.7 - rvm: 2.0.0 - env: PUPPET_VERSION=3.7.4 + env: PUPPET_VERSION=3.8.7 - rvm: 2.0.0 - env: PUPPET_VERSION=3.7.4 FUTURE_PARSER="yes" + env: PUPPET_VERSION=3.8.7 FUTURE_PARSER="yes"