From 672b1028b1b005f680b3c02a21508e4eee4a4252 Mon Sep 17 00:00:00 2001 From: Christer Ekholm Date: Wed, 8 Jul 2020 20:07:22 +0200 Subject: [PATCH 1/2] Fix missing '?' in method-call to .is_a? --- templates/chrony.conf.archlinux.erb | 2 +- templates/chrony.conf.debian.erb | 2 +- templates/chrony.conf.redhat.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/chrony.conf.archlinux.erb b/templates/chrony.conf.archlinux.erb index a54943f..e419096 100644 --- a/templates/chrony.conf.archlinux.erb +++ b/templates/chrony.conf.archlinux.erb @@ -331,7 +331,7 @@ rtconutc # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> <% end end end -%> <% else -%> diff --git a/templates/chrony.conf.debian.erb b/templates/chrony.conf.debian.erb index 43f2ded..16dbdd8 100644 --- a/templates/chrony.conf.debian.erb +++ b/templates/chrony.conf.debian.erb @@ -85,7 +85,7 @@ log <%= @log_options %> # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> <% end end end -%> <% else -%> diff --git a/templates/chrony.conf.redhat.erb b/templates/chrony.conf.redhat.erb index 43f2ded..16dbdd8 100644 --- a/templates/chrony.conf.redhat.erb +++ b/templates/chrony.conf.redhat.erb @@ -85,7 +85,7 @@ log <%= @log_options %> # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> <% end end end -%> <% else -%> From 2140b5e15d74c75982ff8769c8e746ba9d19d7bd Mon Sep 17 00:00:00 2001 From: Christer Ekholm Date: Wed, 8 Jul 2020 20:35:21 +0200 Subject: [PATCH 2/2] Fix erb code for refclocks in templates Remove duplicated if-condition with .each-loop --- templates/chrony.conf.archlinux.erb | 5 ++--- templates/chrony.conf.debian.erb | 5 ++--- templates/chrony.conf.redhat.erb | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/templates/chrony.conf.archlinux.erb b/templates/chrony.conf.archlinux.erb index e419096..8373117 100644 --- a/templates/chrony.conf.archlinux.erb +++ b/templates/chrony.conf.archlinux.erb @@ -330,10 +330,9 @@ rtconutc <%- if defined?(@refclocks) -%> # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> -<% end end end -%> +<% end -%> <% else -%> refclock <%= driver %> <%= @refclocks[driver] %> <% end end -%> diff --git a/templates/chrony.conf.debian.erb b/templates/chrony.conf.debian.erb index 16dbdd8..612a0c4 100644 --- a/templates/chrony.conf.debian.erb +++ b/templates/chrony.conf.debian.erb @@ -84,10 +84,9 @@ log <%= @log_options %> <%- if defined?(@refclocks) -%> # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> -<% end end end -%> +<% end -%> <% else -%> refclock <%= driver %> <%= @refclocks[driver] %> <% end end -%> diff --git a/templates/chrony.conf.redhat.erb b/templates/chrony.conf.redhat.erb index 16dbdd8..612a0c4 100644 --- a/templates/chrony.conf.redhat.erb +++ b/templates/chrony.conf.redhat.erb @@ -84,10 +84,9 @@ log <%= @log_options %> <%- if defined?(@refclocks) -%> # Hardware reference clock drivers <% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks.is_a?(Hash) then @refclocks.keys.sort.each do |driver| -%> -<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> +<% if @refclocks[driver].is_a?(Array) then @refclocks[driver].sort.each do | instance | -%> refclock <%= driver %> <%= instance %> -<% end end end -%> +<% end -%> <% else -%> refclock <%= driver %> <%= @refclocks[driver] %> <% end end -%>