From b850726511ba1a440b6503d7c8ff247e0d45db6b Mon Sep 17 00:00:00 2001 From: Flipez Date: Mon, 29 Jul 2019 23:55:35 +0200 Subject: [PATCH 1/2] Use int for support range; force integer cast Signed-off-by: Flipez --- app/workers/repo_status_worker.rb | 8 ++++---- config/initializers/array.rb | 5 +++++ config/initializers/voxpupuli.rb | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 config/initializers/array.rb diff --git a/app/workers/repo_status_worker.rb b/app/workers/repo_status_worker.rb index a029f5ef..a6801fed 100644 --- a/app/workers/repo_status_worker.rb +++ b/app/workers/repo_status_worker.rb @@ -118,11 +118,11 @@ def perform data.supports_eol_ubuntu << repo if os['operatingsystemrelease'].min < UBUNTU_SUPPORT_RANGE.min data.doesnt_support_latest_ubuntu << repo if os['operatingsystemrelease'].max < UBUNTU_SUPPORT_RANGE.max when 'Debian' - data.supports_eol_debian << repo if os['operatingsystemrelease'].min < DEBIAN_SUPPORT_RANGE.min - data.doesnt_support_latest_debian << repo if os['operatingsystemrelease'].max < DEBIAN_SUPPORT_RANGE.max + data.supports_eol_debian << repo if os['operatingsystemrelease'].all_i.min < DEBIAN_SUPPORT_RANGE.all_i.min + data.doesnt_support_latest_debian << repo if os['operatingsystemrelease'].all_i.max < DEBIAN_SUPPORT_RANGE.all_i.max when 'CentOS', 'RedHat' - data.supports_eol_centos << repo if os['operatingsystemrelease'].min < CENTOS_SUPPORT_RANGE.min - data.doesnt_support_latest_centos << repo if os['operatingsystemrelease'].max < CENTOS_SUPPORT_RANGE.max + data.supports_eol_centos << repo if os['operatingsystemrelease'].all_i.min < CENTOS_SUPPORT_RANGE.all_i.min + data.doesnt_support_latest_centos << repo if os['operatingsystemrelease'].all_i.max < CENTOS_SUPPORT_RANGE.all_i.max end end rescue NoMethodError diff --git a/config/initializers/array.rb b/config/initializers/array.rb new file mode 100644 index 00000000..667422b3 --- /dev/null +++ b/config/initializers/array.rb @@ -0,0 +1,5 @@ +class Array + def all_i + self.map(&:to_i) + end +end \ No newline at end of file diff --git a/config/initializers/voxpupuli.rb b/config/initializers/voxpupuli.rb index 7175da6c..2a84b3a9 100644 --- a/config/initializers/voxpupuli.rb +++ b/config/initializers/voxpupuli.rb @@ -10,5 +10,5 @@ # https://tickets.puppetlabs.com/browse/PA-1869 # https://github.com/camptocamp/facterdb/pull/82#event-1600066178 UBUNTU_SUPPORT_RANGE = ['14.04', '16.04', '18.04'] -DEBIAN_SUPPORT_RANGE = ['8', '9', '10'] -CENTOS_SUPPORT_RANGE = ['6', '7'] +DEBIAN_SUPPORT_RANGE = [8, 9, 10] +CENTOS_SUPPORT_RANGE = [6, 7] From 00211b759265bb2991d44622ff26179a011bfc52 Mon Sep 17 00:00:00 2001 From: Flipez Date: Mon, 29 Jul 2019 23:57:15 +0200 Subject: [PATCH 2/2] New newline Signed-off-by: Flipez --- config/initializers/array.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/array.rb b/config/initializers/array.rb index 667422b3..c81d1511 100644 --- a/config/initializers/array.rb +++ b/config/initializers/array.rb @@ -2,4 +2,4 @@ class Array def all_i self.map(&:to_i) end -end \ No newline at end of file +end