Skip to content

Commit 32c8ff8

Browse files
author
Todd Campbell
authored
Merge pull request #19 from sensu-plugins/bonsai
Updates and Bonsai support
2 parents 45f0ffa + e63052f commit 32c8ff8

10 files changed

Lines changed: 144 additions & 47 deletions

File tree

.bonsai.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
description: "#{repo}"
3+
builds:
4+
- platform: "alpine"
5+
arch: "amd64"
6+
asset_filename: "#{repo}_#{version}_alpine_linux_amd64.tar.gz"
7+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
8+
filter:
9+
- "entity.system.os == 'linux'"
10+
- "entity.system.arch == 'amd64'"
11+
- "entity.system.platform == 'alpine'"
12+
- "entity.system.platform_version.split('.')[0] == '3'"
13+
- platform: "alpine3.8"
14+
arch: "amd64"
15+
asset_filename: "#{repo}_#{version}_alpine3.8_linux_amd64.tar.gz"
16+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
17+
filter:
18+
- "entity.system.os == 'linux'"
19+
- "entity.system.arch == 'amd64'"
20+
- "entity.system.platform == 'alpine'"
21+
- platform: "centos6"
22+
arch: "amd64"
23+
asset_filename: "#{repo}_#{version}_centos6_linux_amd64.tar.gz"
24+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
25+
filter:
26+
- "entity.system.os == 'linux'"
27+
- "entity.system.arch == 'amd64'"
28+
- "entity.system.platform_family == 'rhel'"
29+
- "entity.system.platform_version.split('.')[0] == '6'"
30+
- platform: "centos7"
31+
arch: "amd64"
32+
asset_filename: "#{repo}_#{version}_centos7_linux_amd64.tar.gz"
33+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
34+
filter:
35+
- "entity.system.os == 'linux'"
36+
- "entity.system.arch == 'amd64'"
37+
- "entity.system.platform_family == 'rhel'"
38+
- "entity.system.platform_version.split('.')[0] == '7'"
39+
- platform: "debian"
40+
arch: "amd64"
41+
asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz"
42+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
43+
filter:
44+
- "entity.system.os == 'linux'"
45+
- "entity.system.arch == 'amd64'"
46+
- "entity.system.platform_family == 'debian'"
47+
- platform: "debian9"
48+
arch: "amd64"
49+
asset_filename: "#{repo}_#{version}_debian9_linux_amd64.tar.gz"
50+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
51+
filter:
52+
- "entity.system.os == 'linux'"
53+
- "entity.system.arch == 'amd64'"
54+
- "entity.system.platform_family == 'debian'"
55+
- "entity.system.platform_version.split('.')[0] == '9'"
56+

.rubocop.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,46 @@
11

2-
MethodLength:
2+
Metrics/MethodLength:
33
Max: 200
44

5-
LineLength:
5+
Layout/LineLength:
66
Max: 160
77

8-
AbcSize:
8+
Metrics/AbcSize:
99
Max: 100
1010

11-
FileName:
11+
Naming/FileName:
1212
Enabled: false
1313

14-
PerceivedComplexity:
14+
Metrics/PerceivedComplexity:
1515
Enabled: false
1616

17-
CyclomaticComplexity:
17+
Metrics/CyclomaticComplexity:
1818
Enabled: false
1919

20-
ClassLength:
20+
Metrics/ClassLength:
2121
Enabled: false
2222

23-
IfUnlessModifier:
23+
Style/IfUnlessModifier:
2424
Enabled: false
2525

26-
RegexpLiteral:
26+
Style/RegexpLiteral:
2727
Enabled: false
2828

2929
Style/Documentation:
3030
Enabled: false
31+
32+
Lint/RaiseException:
33+
Enabled: true
34+
35+
Lint/StructNewOverride:
36+
Enabled: true
37+
38+
Style/HashEachMethods:
39+
Enabled: true
40+
41+
Style/HashTransformKeys:
42+
Enabled: true
43+
44+
Style/HashTransformValues:
45+
Enabled: true
46+

.travis.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
language: ruby
2+
services:
3+
- docker
24
cache:
35
- bundler
4-
before_install: gem install bundler -v 1.15
56
install:
67
- bundle install
78
rvm:
8-
- 2.0
9-
- 2.1
10-
- 2.2
119
- 2.3.0
1210
- 2.4.1
1311
notifications:
@@ -20,17 +18,23 @@ script:
2018
- gem build sensu-plugins-systemd.gemspec
2119
- gem install sensu-plugins-systemd-*.gem
2220
- bundle exec rake default
21+
before_deploy:
22+
- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone'"
2323
deploy:
24-
provider: rubygems
24+
- provider: script
25+
script: bonsai/ruby-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-hardware
26+
skip_cleanup: true
27+
on:
28+
tags: true
29+
all_branches: true
30+
rvm: 2.4.1
31+
- provider: rubygems
2532
api_key:
2633
secure: Hf1ZRHiWtWvOlcoLmcFJSql688r7s8CkTRUO5FYvUBjJE/x/P2+UDFONcYzycEAkLXzv9MIMXHO8vZ2m5rVSqbiP055+MtzRnukO2OaF2Ke0vYCuArOxj/LvhKAuLJRVNYbD138MltCnqUMjU2Ks4b4Z/wtHqSkbOoBsyTwwpYq0HiCbQyGNkacGzMZ44vnPR3cS0TrljjwYhnn1gDKkEkQf1p3iNrmIIapspU64U36KsxaGccFiXo2YSI9vBY+kssfGIOB5YAXoFHQ3YqdTpGMy7Q587IttlIlPQwhvYvK9lCZMZSCxmaZMGq2zy+3ttKe9CEejPGAtaPkiYrmmuM1hZUgQDk94znsTitpZxX5vlFMv5BUnxiOHcL+aQKFG4DlTj7KD+7a0BPb3AbUeD2njql6elCXiGeqzKgjS5x9W7WDZdoMj8VdQWzs+hh98C9yY5DDipp13yGJ3gqzKmKRbaHXUA9wLY4ic0022+ZwxCKX5TKqjOAi8WmQSCG19r+/uIaFY5MeTE7wrsuA0oSWM5YA9UaJNf5WbpUpC9tLG2owvAOjtEwhBBS9EijhiME8ABKBqp/RWJYqrj8PDrucDYLm2pB2PzlLKqs/+UQ//Rh4U/TKRLdWBrCevVr5hw6TLRl5ThoEjL1heqHsoH3X51rhtt3MBleYkawn37jg=
2734
gem: sensu-plugins-systemd
2835
on:
2936
tags: true
3037
all_branches: true
31-
rvm: 2.0
32-
rvm: 2.1
33-
rvm: 2.2
3438
rvm: 2.3.0
3539
rvm: 2.4.1
3640
repo: sensu-plugins/sensu-plugins-systemd

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
66

77
## [Unreleased]
88

9+
### Breaking Changes
10+
- Update minimum required ruby version to 2.3. Drop unsupported ruby versions.
11+
- Bump `sensu-plugin` dependency from `~> 1.2` to `~> 4.0`
12+
13+
### Added
14+
- Bonsai asset support
15+
### Changed
16+
- Updated bundler dependancy to '~> 2.1'
17+
- Updated rubocop dependency to '~> 0.81.0'
18+
- Remediated rubocop issues
19+
- Updated codeclimate-test-reporter to '~> 1.0'
20+
- Updated rake dependency to '~> 13.0'
21+
- Updated github-markup to '~> 3.0'
22+
923
## [0.1.0] - 2017-09-10
1024
### Added
1125
- missing changelog entries (@majormoses)

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
gemspec

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'github/markup'
35
require 'redcarpet'
@@ -28,7 +30,7 @@ task :check_binstubs do
2830
unless Dir.glob('bin/**/*.rb').empty?
2931
bin_list = Gem::Specification.load('sensu-plugins-systemd.gemspec').executables
3032
bin_list.each do |b|
31-
`which #{ b }`
33+
`which #{b}`
3234
unless $CHILD_STATUS.success?
3335
puts "#{b} was not a binstub"
3436
exit

bin/check-systemd.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: false
3+
24
#
35
# check-systemd.rb
46
#
@@ -54,6 +56,7 @@ def unit_services
5456
systemd_output.split("\n").each do |line|
5557
line_array = line.split(' ')
5658
next unless @services.any? { |service| line_array[0].include?(service) }
59+
5760
service_hash = {}
5861
service_hash['name'] = line_array[0]
5962
service_hash['load'] = line_array[1]

lib/sensu-plugins-systemd.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# frozen_string_literal: true
12

23
require 'sensu-plugins-systemd/version'

lib/sensu-plugins-systemd/version.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module SensuPluginsSystemd
24
module Version
35
MAJOR = 0

sensu-plugins-systemd.gemspec

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,43 @@
1-
lib = File.expand_path('../lib', __FILE__)
1+
# frozen_string_literal: true
2+
3+
lib = File.expand_path('lib', __dir__)
24
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
35

46
require 'date'
7+
require_relative 'lib/sensu-plugins-systemd'
58

6-
if RUBY_VERSION < '2.0.0'
7-
require 'sensu-plugins-systemd'
8-
else
9-
require_relative 'lib/sensu-plugins-systemd'
10-
end
11-
12-
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
13-
s.name = 'sensu-plugins-systemd'
14-
s.version = SensuPluginsSystemd::Version::VER_STRING
15-
s.platform = Gem::Platform::RUBY
16-
s.authors = ['mickfeech and contributors']
17-
s.date = Date.today.to_s
18-
s.email = [
9+
Gem::Specification.new do |s|
10+
s.name = 'sensu-plugins-systemd'
11+
s.version = SensuPluginsSystemd::Version::VER_STRING
12+
s.platform = Gem::Platform::RUBY
13+
s.authors = ['mickfeech and contributors']
14+
s.email = [
1915
'cmcfee@kent.edu',
2016
'<sensu-users@googlegroups.com>'
2117
]
22-
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
23-
s.homepage = 'https://github.com/mickfeech/sensu-plugins-systemd'
24-
s.summary = 'This provides functionality to check systemd services.'
25-
s.description = 'Plugins to provide functionality to check systemd services for Sensu, a monitoring framework'
26-
s.license = 'MIT'
27-
s.has_rdoc = false
28-
s.require_paths = ['lib']
29-
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
18+
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
19+
s.homepage = 'https://github.com/mickfeech/sensu-plugins-systemd'
20+
s.summary = 'This provides functionality to check systemd services.'
21+
s.description = 'Plugins to provide functionality to check systemd services for Sensu, a monitoring framework'
22+
s.license = 'MIT'
23+
s.has_rdoc = false
24+
s.require_paths = ['lib']
25+
s.required_ruby_version = '>= 2.3'
26+
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
3027
# s.test_files = Dir['test/*.rb']
31-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
28+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
3229

33-
s.add_runtime_dependency 'sensu-plugin', '~> 1.2'
30+
s.add_runtime_dependency 'sensu-plugin', '~> 4.0'
3431
# s.add_dependency('json')
3532
# s.add_dependency('mixlib-cli', '>= 1.5.0')
3633

37-
s.add_development_dependency 'bundler', '~> 1.7'
38-
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
39-
s.add_development_dependency 'github-markup', '~> 1.3'
34+
s.add_development_dependency 'bundler', '~> 2.1'
35+
s.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
36+
s.add_development_dependency 'github-markup', '~> 3.0'
4037
s.add_development_dependency 'pry', '~> 0.10'
41-
s.add_development_dependency 'rake', '~> 10.5'
38+
s.add_development_dependency 'rake', '~> 13.0'
4239
s.add_development_dependency 'redcarpet', '~> 3.2'
43-
s.add_development_dependency 'rubocop', '~> 0.37'
4440
s.add_development_dependency 'rspec', '~> 3.4'
41+
s.add_development_dependency 'rubocop', '~> 0.81.0'
4542
s.add_development_dependency 'yard', '~> 0.8'
4643
end

0 commit comments

Comments
 (0)