From 6620a306335af7971587dfcf9c4df57af80b082c Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Wed, 18 May 2022 15:24:34 -0400 Subject: [PATCH] Upgrade to td-agent v4 on older Puppet installs The fluentd_gem provider for installing fluentd plugins uses Puppet's built-in gem provider. Unfortunately, that gem provider on our Puppet version is not compatible with td-agent's new embedded Ruby since it includes the no-rdoc and no-ri flags deprecated and replaced by the no-document flag. This install function override replaces the flags and might be removable after a Puppet upgrade. --- lib/puppet/provider/package/fluentd-gem.rb | 13 +++++++++++-- manifests/params.pp | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/package/fluentd-gem.rb b/lib/puppet/provider/package/fluentd-gem.rb index 0e981ac..ba78441 100644 --- a/lib/puppet/provider/package/fluentd-gem.rb +++ b/lib/puppet/provider/package/fluentd-gem.rb @@ -8,11 +8,20 @@ Puppet::Type.type(:package).provide :fluentd_gem, :parent => :gem do not a valid URL, it will be interpreted as the path to a local gem file. If source is not present at all, the gem will be installed from the default gem repositories." - confine :exists => "/opt/td-agent/embedded/bin/gem" + confine :exists => "/opt/td-agent/bin/gem" has_feature :versionable, :install_options - commands :gemcmd => "/opt/td-agent/embedded/bin/gem" + commands :gemcmd => "/opt/td-agent/bin/gem" + + def install(useversion = true) + command = [command(:gemcmd), "install"] + command << "--no-document" << resource[:name] + output = execute(command) + + # Apparently some stupid gem versions don't exit non-0 on failure + self.fail "Could not install: #{output.chomp}" if output.include?("ERROR") + end def uninstall command = [command(:gemcmd), "uninstall"] diff --git a/manifests/params.pp b/manifests/params.pp index 33ac0b2..96d42a2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -19,7 +19,7 @@ class fluentd::params { $user_group = 'td-agent' $user_groups = ['adm'] # repo params - $repo_version = 3 + $repo_version = 4 case $::osfamily { 'Debian': {