From f7fd88cbf23ae55d9e73a102ddf0c11f6b6aa447 Mon Sep 17 00:00:00 2001 From: doomnuggets Date: Fri, 27 Jan 2017 19:08:00 +0100 Subject: [PATCH] Normalize Repository file for RHEL and CentOS (#45) * 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 * Update install.pp * Update telegraf_spec.rb * Update telegraf_spec.rb copy pasterino typo :) * Update install.pp * Test CentOS and RHEL * Update .travis.yml --- manifests/install.pp | 6 +++--- spec/classes/telegraf_spec.rb | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e671c65..dfa987b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -26,11 +26,11 @@ } 'RedHat': { yumrepo { 'influxdata': - descr => 'influxdata', + descr => "InfluxData Repository - ${::operatingsystem} \$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, + gpgcheck => 1, } Yumrepo['influxdata'] -> Package['telegraf'] } diff --git a/spec/classes/telegraf_spec.rb b/spec/classes/telegraf_spec.rb index 7ec22ce..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/rhel/#{releasenum}/x86_64/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/rhel/#{releasenum}/x86_64/unstable", + :baseurl => "https://repos.influxdata.com/#{operatingsystem.downcase}/\$releasever/\$basearch/unstable", ) } end