Skip to content

Commit

Permalink
Fix module for puppet 6 support
Browse files Browse the repository at this point in the history
There are three issues for puppet 6 tests.

The first is that the tdagent provider definition is incorrect. We
don't need to wrap the definition in a parser function as it should
just be loaded.

The second is that we need to include the fluentd when testing the
plugin resource so that the relationship matcher works correctly.

The third is that yumrepo has been moved to it's own module and must be
defined as a dependency.

There is also an issue with the acceptance test because we don't have
the required dependencies to build the test plugin.

Fixes: soylent#39
  • Loading branch information
mwhahaha committed Jun 26, 2019
1 parent 4dfc15a commit 6924958
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ fixtures:
apt:
repo: "git://github.com/puppetlabs/puppetlabs-apt.git"
ref: "4.1.0"
yumrepo_core:
repo: "git://github.com/puppetlabs/puppetlabs-yumrepo_core.git"
ref: "1.0.3"
symlinks:
fluentd: "#{source_dir}"
12 changes: 6 additions & 6 deletions lib/puppet/provider/package/tdagent.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file must be compatible with Ruby 1.8.7 in order to work on EL6.
module Puppet::Parser::Functions
Puppet::Type.type(:package).provide :tdagent, :parent => :gem, :source => :gem do
has_feature :install_options, :versionable
commands :gemcmd => '/opt/td-agent/usr/sbin/td-agent-gem'
end
require 'puppet'
require 'puppet/provider/package'

Puppet::Type.type(:package).provide :tdagent, :parent => :gem, :source => :gem do
has_feature :install_options, :versionable
commands :gemcmd => '/opt/td-agent/usr/sbin/td-agent-gem'
end
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{
"name": "puppetlabs/apt",
"version_requirement": ">= 2.0.0 < 5.0.0"
},
{
"name": "puppetlabs/yumrepo_core",
"version_requirement": ">= 1.0.0 < 2.0.0"
}
],
"issues_url": "https://github.com/soylent/konstantin-fluentd/issues",
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/nodesets/centos-6-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HOSTS:
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'yum install -y tar'
- 'yum install -y tar ruby ruby-devel make gcc'
CONFIG:
log_level: verbose
type: foss
2 changes: 1 addition & 1 deletion spec/acceptance/nodesets/centos-7-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HOSTS:
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'yum install -y initscripts'
- 'yum install -y initscripts ruby ruby-devel make gcc'
CONFIG:
log_level: verbose
type: foss
1 change: 1 addition & 0 deletions spec/defines/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

RSpec.describe 'fluentd::plugin' do
let(:title) { 'fluent-plugin-test' }
let(:pre_condition) { 'include ::fluentd' }

context 'with redhat', :redhat do
it { is_expected.to contain_package(title).with(provider: 'tdagent') }
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
hosts.each do |host|
on host, puppet('module', 'install', 'puppetlabs-stdlib')
on host, puppet('module', 'install', 'puppetlabs-apt')
on host, puppet('module', 'install', 'puppetlabs-yumrepo_core')
end
end
end

0 comments on commit 6924958

Please sign in to comment.