Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for Puppet 7 / stdlib9 #1

Open
wants to merge 1 commit into
base: 4.0.0_query_log
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

42 changes: 16 additions & 26 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
source 'https://rubygems.org'

group :development, :test do
gem 'rake', '< 11.0', require: false
gem 'rspec', '< 3.2.0', require: false
gem 'rspec-puppet', '~> 2.3', require: false
gem 'puppetlabs_spec_helper', require: false
gem 'puppet-lint', require: false
gem 'simplecov', require: false
gem 'puppet_facts', require: false
gem 'json_pure', '~> 1.8', require: false
gem 'json', require: false
gem 'metadata-json-lint', require: false
gem 'rspec-puppet-facts', require: false
end
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 7.25'

group :system_tests do
gem 'beaker-rspec', require: false
gem 'serverspec', require: false
group :lint do
gem "puppet-lint", "~> 4.0"
gem "puppet-syntax", "~> 3.3"
gem "metadata-json-lint", "~> 3.0"
end

if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, require: false
else
gem 'facter', require: false
group :test do
gem "rspec-puppet", "~> 3.0"
gem "puppetlabs_spec_helper", "~> 6.0.1"
gem "semantic_puppet", "~> 1.1.0"
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, require: false
else
gem 'puppet', require: false
group :beaker do
gem 'serverspec', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'pry', :require => false
end

# vim:ft=ruby
66 changes: 55 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-lint/tasks/puppet-lint'

PuppetLint.configuration.send('relative')
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.ignore_paths = ["pkg/**/*", "vendor/**/*", "spec/**/*"]

desc "Run syntax, lint, and beaker/rspec tests."
task :test => [:validate, :lint, :spec]
exclude_paths = [
'spec/fixtures/**/*',
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]

PuppetSyntax::RakeTask.new
PuppetSyntax.exclude_paths = exclude_paths
PuppetSyntax.fail_on_deprecation_notices = true

# Puppet-Lint 1.1.0
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|

# Pattern of files to ignore
config.ignore_paths = exclude_paths

# List of checks to disable
config.disable_checks = [
'80chars',
'140chars',
'documentation',
'class_inherits_from_params_class',
'arrow_on_right_operand_line',
'autoloader_layout',
]

# Should puppet-lint prefix it's output with the file being checked,
# defaults to true
config.with_filename = false

# Should the task fail if there were any warnings, defaults to false
config.fail_on_warnings = true

# Format string for puppet-lint's output (see the puppet-lint help output
# for details
config.log_format = '%{path}:%{line}: [%{KIND}] (%{check}) %{message}'

# Print out the context for the problem, defaults to false
config.with_context = true

# Enable automatic fixing of problems, defaults to false
config.fix = false

# Show ignored problems in the output, defaults to false
config.show_ignored = true
end

task :metadata do
sh "metadata-json-lint --no-strict-license metadata.json"
end

task :default => [:syntax, :lint, :metadata]
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@
$continuous_queries_run_interval = undef
$influxdb_user = 'influxdb'
$influxdb_group = 'influxdb'
case $::osfamily {
case $facts['os']['family'] {
'Debian', 'RedHat', 'Amazon': {
$manage_repos = true
}
'Archlinux': {
$manage_repos = false
}
default: {
fail("Unsupported managed repository for osfamily: ${::osfamily}, operatingsystem: ${::operatingsystem},\
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']},\
module ${module_name} currently only supports managing repos for osfamily RedHat, Debian and Archlinux")
}
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class influxdb::repo {

case $::osfamily {
case $facts['os']['family'] {
'Debian': {
class { 'influxdb::repo::apt': }
}
'RedHat': {
class { 'influxdb::repo::yum': }
}
default: {
fail("Unsupported managed repository for osfamily: ${::osfamily}, operatingsystem: ${::operatingsystem},\
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']},\
module ${module_name} currently only supports managing repos for osfamily RedHat and Debian")
}
}
Expand Down
12 changes: 6 additions & 6 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
class influxdb::repo::apt {

#downcase operatingsystem
$_operatingsystem = downcase($::operatingsystem)
$_operatingsystem = downcase($facts['os']['name'])

apt::source { 'repos.influxdata.com':
location => "https://repos.influxdata.com/${_operatingsystem}",
release => $::lsbdistcodename,
repos => 'stable',
key => {
location => "https://repos.influxdata.com/${_operatingsystem}",
release => $facts['os']['distro']['codename'],
repos => 'stable',
key => {
'id' => '05CE15085FC09D18E99EFB22684A14CF2582E0C5',
'source' => 'https://repos.influxdata.com/influxdb.key',
},
include => { 'src' => false },
include => { 'src' => false },
}

Apt::Source['repos.influxdata.com'] -> Package<| tag == 'influxdb' |>
Expand Down
6 changes: 3 additions & 3 deletions manifests/repo/yum.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# PRIVATE CLASS: do not use directly
class influxdb::repo::yum {

$_operatingsystem = $::operatingsystem ? {
'CentOS' => downcase($::operatingsystem),
$_operatingsystem = $facts['os']['name'] ? {
'CentOS' => downcase(facts['os']['name']),
default => 'rhel',
}

yumrepo { 'repos.influxdata.com':
descr => "InfluxDB Repository - ${::operatingsystem} \$releasever",
descr => "InfluxDB Repository - ${facts['os']['name']} \$releasever",
baseurl => "https://repos.influxdata.com/${$_operatingsystem}/\$releasever/\$basearch/stable",
enabled => 1,
gpgcheck => 1,
Expand Down
18 changes: 4 additions & 14 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "golja-influxdb",
"version": "4.0.0",
"version": "5.0.0",
"author": "Dejan Golja",
"summary": "Manage InfluxDB version 1.0.0+. For previous supported version check README.md",
"license": "Apache-2.0",
Expand All @@ -15,40 +15,30 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"12.04",
"14.04"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 3.0.0 < 8.0.0"
"version_requirement": ">= 7.0.0"
}
],
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"},
{"name":"puppetlabs/apt","version_requirement":">=2.0.0 <9.0.0"}
{"name":"puppetlabs/stdlib","version_requirement":">= 9.0.0"},
{"name":"puppetlabs/apt","version_requirement":">=2.0.0"}
]
}