From a65ea8cb47297e1c8f70e0e745aa48e5882aa4aa Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Thu, 26 Jan 2017 14:55:46 +0100 Subject: [PATCH 1/7] Normalize Repository file for RHEL and CentOS According to the following we could make use of `yum variables`: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Using_Yum_Variables.html Furthermore it might be preferable to set the `descr` field to the value on the official docs instructions: https://www.influxdata.com/package-repository-for-linux/#centos-users --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e671c65..334cd2b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -26,9 +26,9 @@ } 'RedHat': { yumrepo { 'influxdata': - descr => 'influxdata', + descr => 'InfluxData Repository - RHEL $releasever', enabled => 1, - baseurl => "https://repos.influxdata.com/rhel/${::operatingsystemmajrelease}/${::architecture}/${::telegraf::repo_type}", + baseurl => "https://repos.influxdata.com/${_operatingsystem}/\$releasever/\$basearch/${::telegraf::repo_type}", gpgkey => 'https://repos.influxdata.com/influxdb.key', gpgcheck => true, } From 624a53a5b97d5f3e17ddfdea9fd3f76de5ceb047 Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Thu, 26 Jan 2017 15:15:47 +0100 Subject: [PATCH 2/7] Update install.pp --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 334cd2b..11e7f26 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -26,11 +26,11 @@ } 'RedHat': { yumrepo { 'influxdata': - descr => 'InfluxData Repository - RHEL $releasever', + descr => "InfluxData Repository - ${::operatingsystem) \$releasever", enabled => 1, baseurl => "https://repos.influxdata.com/${_operatingsystem}/\$releasever/\$basearch/${::telegraf::repo_type}", gpgkey => 'https://repos.influxdata.com/influxdb.key', - gpgcheck => true, + gpgcheck => 1, } Yumrepo['influxdata'] -> Package['telegraf'] } From ff13e96a524596ba3f6dcc4ed6f212c057da1d4e Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 11:48:45 +0100 Subject: [PATCH 3/7] Update telegraf_spec.rb --- spec/classes/telegraf_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/telegraf_spec.rb b/spec/classes/telegraf_spec.rb index 7ec22ce..96976de 100644 --- a/spec/classes/telegraf_spec.rb +++ b/spec/classes/telegraf_spec.rb @@ -80,7 +80,7 @@ it { should contain_service('telegraf') } it { should contain_yumrepo('influxdata') .with( - :baseurl => "https://repos.influxdata.com/rhel/#{releasenum}/x86_64/stable", + :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/\$basearch/stable", ) } @@ -88,7 +88,7 @@ let(:params) { {:repo_type => 'unstable' } } it { should contain_yumrepo('influxdata') .with( - :baseurl => "https://repos.influxdata.com/rhel/#{releasenum}/x86_64/unstable", + :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/unstable", ) } end From 10a85c742ea45958fd7f482da221fc5fc2be7cf0 Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 11:50:44 +0100 Subject: [PATCH 4/7] Update telegraf_spec.rb copy pasterino typo :) --- spec/classes/telegraf_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/telegraf_spec.rb b/spec/classes/telegraf_spec.rb index 96976de..bdbc2bc 100644 --- a/spec/classes/telegraf_spec.rb +++ b/spec/classes/telegraf_spec.rb @@ -80,7 +80,7 @@ it { should contain_service('telegraf') } it { should contain_yumrepo('influxdata') .with( - :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/\$basearch/stable", + :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/stable", ) } From c720ec76fc52f48de2cb56393d1f94a3e3a2ced4 Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 12:08:41 +0100 Subject: [PATCH 5/7] Update install.pp --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 11e7f26..dfa987b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -26,7 +26,7 @@ } 'RedHat': { yumrepo { 'influxdata': - descr => "InfluxData Repository - ${::operatingsystem) \$releasever", + descr => "InfluxData Repository - ${::operatingsystem} \$releasever", enabled => 1, baseurl => "https://repos.influxdata.com/${_operatingsystem}/\$releasever/\$basearch/${::telegraf::repo_type}", gpgkey => 'https://repos.influxdata.com/influxdb.key', From fd4531c1398129c0e183d7b1f223a49a98e2385e Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 12:27:52 +0100 Subject: [PATCH 6/7] Test CentOS and RHEL --- spec/classes/telegraf_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/classes/telegraf_spec.rb b/spec/classes/telegraf_spec.rb index bdbc2bc..3c7a2fb 100644 --- a/spec/classes/telegraf_spec.rb +++ b/spec/classes/telegraf_spec.rb @@ -2,11 +2,11 @@ describe 'telegraf' do context 'Supported operating systems' do - ['RedHat', ].each do |osfamily| + ['RedHat', 'CentOS'].each do |operatingsystem| [6,7].each do |releasenum| - context "RedHat #{releasenum} release specifics" do + context "#{osfamily} #{releasenum} release specifics" do let(:facts) {{ - :operatingsystem => osfamily, + :operatingsystem => operatingsystem, :operatingsystemrelease => releasenum, :operatingsystemmajrelease => releasenum, }} @@ -80,7 +80,7 @@ it { should contain_service('telegraf') } it { should contain_yumrepo('influxdata') .with( - :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/stable", + :baseurl => "https://repos.influxdata.com/#{operatingsystem.downcase}/\$releasever/\$basearch/stable", ) } @@ -88,7 +88,7 @@ let(:params) { {:repo_type => 'unstable' } } it { should contain_yumrepo('influxdata') .with( - :baseurl => "https://repos.influxdata.com/#{Facter['::operatingsystem'].value.downcase}/\$releasever/\$basearch/unstable", + :baseurl => "https://repos.influxdata.com/#{operatingsystem.downcase}/\$releasever/\$basearch/unstable", ) } end From a1f7f59e425d7167bf35df1a992b6c2988399ff8 Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 12:33:36 +0100 Subject: [PATCH 7/7] Update .travis.yml