diff --git a/.fixtures.yml b/.fixtures.yml index 9603e539..e8d3a33f 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -12,7 +12,6 @@ fixtures: puppetserver_gem: repo: "git://github.com/puppetlabs/puppetlabs-puppetserver_gem.git" ref: "1.0.0" - ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git" forge_modules: yumrepo_core: repo: "puppetlabs/yumrepo_core" diff --git a/environments/etc/Puppetfile b/environments/etc/Puppetfile index 162781ff..d5db0451 100644 --- a/environments/etc/Puppetfile +++ b/environments/etc/Puppetfile @@ -3,7 +3,6 @@ mod 'datadog_agent', :local => true mod 'puppetlabs-apt', '2.4.0' mod 'puppetlabs-concat', '4.0.0' mod 'puppetlabs-puppetserver_gem', '1.0.0' -mod 'puppetlabs-ruby', '1.0.0' mod 'puppetlabs-stdlib', '4.25.0' mod 'puppetlabs-powershell', '2.3.0' mod 'puppetlabs-yumrepo_core', '1.0.3' diff --git a/manifests/params.pp b/manifests/params.pp index dcb0b41b..a3ab161a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -26,6 +26,22 @@ case $::operatingsystem { 'Ubuntu','Debian','Raspbian' : { $rubydev_package = 'ruby-dev' + case $::operatingsystemrelease{ + '14.04': { + # Specific ruby/rubygems package name for Ubuntu 14.04 + $ruby_package = 'ruby' + $rubygems_package = 'ruby1.9.1-full' + } + '18.04': { + # Specific ruby/rubygems package name for Ubuntu 18.04 + $ruby_package = 'ruby-full' + $rubygems_package = 'rubygems' + } + default: { + $ruby_package = 'ruby' + $rubygems_package = 'rubygems' + } + } $legacy_conf_dir = '/etc/dd-agent/conf.d' $conf_dir = '/etc/datadog-agent/conf.d' $dd_user = 'dd-agent' @@ -40,6 +56,8 @@ } 'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux', 'AlmaLinux', 'Rocky', 'OpenSuSE', 'SLES' : { $rubydev_package = 'ruby-devel' + $ruby_package = 'ruby' + $rubygems_package = 'rubygems' $legacy_conf_dir = '/etc/dd-agent/conf.d' $conf_dir = '/etc/datadog-agent/conf.d' $dd_user = 'dd-agent' diff --git a/manifests/reports.pp b/manifests/reports.pp index 350f8d7c..9ff40a47 100644 --- a/manifests/reports.pp +++ b/manifests/reports.pp @@ -49,9 +49,15 @@ } if (! defined(Package['rubygems'])) { - # Ensure rubygems is installed - class { 'ruby': - rubygems_update => false + package { 'ruby': + ensure => 'installed', + name => $datadog_agent::params::ruby_package + } + + package { 'rubygems': + ensure => 'installed', + name => $datadog_agent::params::rubygems_package, + require => Package['ruby'] } } diff --git a/metadata.json b/metadata.json index eef0a1ff..b2bbbdfa 100644 --- a/metadata.json +++ b/metadata.json @@ -12,10 +12,6 @@ "name": "puppetlabs/stdlib", "version_requirement": ">=4.25.0 <9.0.0" }, - { - "name": "puppetlabs/ruby", - "version_requirement": ">=1.0.0 <2.0.0" - }, { "name": "puppetlabs/concat", "version_requirement": ">=4.0.0 <8.0.0" diff --git a/spec/classes/datadog_agent_reports_spec.rb b/spec/classes/datadog_agent_reports_spec.rb index 47fa2020..1ff45f21 100644 --- a/spec/classes/datadog_agent_reports_spec.rb +++ b/spec/classes/datadog_agent_reports_spec.rb @@ -31,8 +31,7 @@ is_expected.to raise_error(Puppet::Error) end else - it { is_expected.to contain_class('ruby').with_rubygems_update(false) } - it { is_expected.to contain_class('ruby::params') } + it { is_expected.to contain_package('ruby').with_ensure('installed') } it { is_expected.to contain_package('rubygems').with_ensure('installed') } @@ -87,8 +86,6 @@ } end - it { is_expected.to contain_class('ruby').with_rubygems_update(false) } - it { is_expected.to contain_class('ruby::params') } it { is_expected.to contain_package('ruby').with_ensure('installed') } it { is_expected.to contain_package('rubygems').with_ensure('installed') } @@ -131,8 +128,6 @@ } end - it { is_expected.to contain_class('ruby').with_rubygems_update(false) } - it { is_expected.to contain_class('ruby::params') } it { is_expected.to contain_package('ruby').with_ensure('installed') } it { is_expected.to contain_package('rubygems').with_ensure('installed') } @@ -170,8 +165,6 @@ } end - it { is_expected.to contain_class('ruby').with_rubygems_update(false) } - it { is_expected.to contain_class('ruby::params') } it { is_expected.to contain_package('ruby').with_ensure('installed') } it { is_expected.to contain_package('rubygems').with_ensure('installed') } @@ -211,8 +204,6 @@ } end - it { is_expected.not_to contain_class('ruby').with_rubygems_update(false) } - it { is_expected.not_to contain_class('ruby::params') } it { is_expected.not_to contain_package('ruby').with_ensure('installed') } it { is_expected.not_to contain_package('rubygems').with_ensure('installed') }