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

Multiple security and misc updates: #9

Merged
merged 1 commit into from
Jul 19, 2018
Merged
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
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ RegexpLiteral:
Style/Documentation:
Enabled: false
AllCops:
TargetRubyVersion: 2.3
Exclude:
- 'test/**/*.rb'
- 'sensu-plugins-lvm.gemspec'
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ cache:
install:
- bundle install
rvm:
- 2.0
- 2.1
- 2.2
- 2.3.0
- 2.4.1
notifications:
Expand All @@ -25,9 +22,6 @@ deploy:
on:
tags: true
all_branches: true
rvm: 2.0
rvm: 2.1
rvm: 2.2
rvm: 2.3.0
rvm: 2.4.1
repo: sensu-plugins/sensu-plugins-lvm
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang

## [Unreleased]

### Breaking Changes
- removed ruby `< 2.3` support (@majormoses)
- bumped dependency of `sensu-plugin` to `~> 2.5` you can read about it [here](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v145---2017-03-07) (@majormoses)

### Security
- updated yard dependency to `~> 0.9.11` per: https://nvd.nist.gov/vuln/detail/CVE-2017-17042 (@majormoses)
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)

### Changed
- appeased the cops (@majormoses)

### Removed
- gemnasium badge (@majormoses)

### Added
- slack badge (@majormoses)

## [1.0.1] - 2018-07-06
### Fixed
- check-lv-usage.rb: emit an `unknown` with a useful message rather than a false `ok` when no volumes are found (@sys-ops)
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in sensu-plugins-lvm.gemspec
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-lvm.svg)](http://badge.fury.io/rb/sensu-plugins-lvm)
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-lvm/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-lvm)
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-lvm/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-lvm)
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-lvm.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-lvm)
[![Community Slack](https://slack.sensu.io/badge.svg)](https://slack.sensu.io/badge)

## Functionality

Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'github/markup'
require 'redcarpet'
Expand Down
12 changes: 6 additions & 6 deletions bin/check-lv-usage.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: false

#
# check-lv-usage
#
Expand Down Expand Up @@ -83,13 +85,11 @@ def logical_volumes
end

def empty_volumes_msg
# NOTE: when we drop ruby < 2.3 support switch to <<~ and indent sanely
string = <<-HEREDOC
An error occured getting the LVM info: got empty list of volumes.
Check to ensure sensu has been configured with appropriate permissions.
On linux systems it will generally need to allow executing
<<~HEREDOC
An error occured getting the LVM info: got empty list of volumes.
Check to ensure sensu has been configured with appropriate permissions.
On linux systems it will generally need to allow executing `/sbin/lvm`
HEREDOC
string.squeeze(' ')
end

def filter_volumes(list)
Expand Down
8 changes: 5 additions & 3 deletions bin/check-vg-usage.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: false

#
# check-vg-usage
#
Expand Down Expand Up @@ -72,8 +74,8 @@ def initialize
def volume_groups
LVM::LVM.new.volume_groups.each do |line|
begin
next if config[:ignorevg] && config[:ignorevg].include?(line.name)
next if config[:ignorevgre] && config[:ignorevgre].match(line.name)
next if config[:ignorevg]&.include?(line.name)
next if config[:ignorevgre]&.match(line.name)
next if config[:includevg] && !config[:includevg].include?(line.name)
rescue StandardError
unknown 'An error occured getting the LVM info'
Expand Down Expand Up @@ -107,7 +109,7 @@ def to_human(bytes)
[1024, 'KiB'],
[0, 'B']
].detect { |unit| bytes >= unit[0] }
if bytes > 0
if bytes.positive?
bytes / units[0]
else
units[1]
Expand Down
6 changes: 4 additions & 2 deletions bin/metrics-vg-usage.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /usr/bin/env ruby
# frozen_string_literal: false

#
# metrics-vg-usage
#
Expand Down Expand Up @@ -59,8 +61,8 @@ class VgUsageMetrics < Sensu::Plugin::Metric::CLI::Graphite
def volume_groups
LVM::LVM.new.volume_groups.each do |line|
begin
next if config[:ignorevg] && config[:ignorevg].include?(line.name)
next if config[:ignorevgre] && config[:ignorevgre].match(line.name)
next if config[:ignorevg]&.include?(line.name)
next if config[:ignorevgre]&.match(line.name)
next if config[:includevg] && !config[:includevg].include?(line.name)
rescue StandardError
unknown 'An error occured getting the LVM info'
Expand Down
2 changes: 2 additions & 0 deletions lib/sensu-plugins-lvm.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'sensu-plugins-lvm/version'
2 changes: 2 additions & 0 deletions lib/sensu-plugins-lvm/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SensuPluginsLvm
module Version
MAJOR = 1
Expand Down
26 changes: 14 additions & 12 deletions sensu-plugins-lvm.gemspec
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
# frozen_string_literal: true

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'date'
require_relative 'lib/sensu-plugins-lvm'

Gem::Specification.new do |s|
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
s.authors = ['Sensu-Plugins and contributors']
s.date = Date.today.to_s
s.description = 'Sensu plugins for LVM'
s.email = '<[email protected]>'
s.executables = Dir.glob('bin/**/*').map { |file| File.basename(file) }
s.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md CHANGELOG.md)
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-lvm'
s.license = 'MIT'
s.metadata = {
'maintainer' => 'sensu-plugin',
'development_status' => 'active',
'production_status' => 'unstable - testing recommended',
'release_draft' => 'false',
'release_prerelease' => 'false'
}
'maintainer' => 'sensu-plugin',
'development_status' => 'active',
'production_status' => 'unstable - testing recommended',
'release_draft' => 'false',
'release_prerelease' => 'false'
}
s.name = 'sensu-plugins-lvm'
s.platform = Gem::Platform::RUBY
s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu'
s.require_paths = ['lib']
s.required_ruby_version = '>= 2.0.0'
s.required_ruby_version = '>= 2.3.0'
s.summary = 'Sensu plugins for lvm'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.version = SensuPluginsLvm::Version::VER_STRING

s.add_runtime_dependency 'sensu-plugin', '~> 1.2'
s.add_runtime_dependency 'chef-ruby-lvm', '~> 0.3.0'
s.add_runtime_dependency 'chef-ruby-lvm-attrib', '~> 0.2.1'
s.add_runtime_dependency 'sensu-plugin', '~> 2.5'

s.add_development_dependency 'bundler', '~> 1.7'
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
s.add_development_dependency 'github-markup', '~> 1.3'
s.add_development_dependency 'pry', '~> 0.10'
s.add_development_dependency 'rake', '~> 10.5'
s.add_development_dependency 'redcarpet', '~> 3.2'
s.add_development_dependency 'rubocop', '~> 0.37'
s.add_development_dependency 'rspec', '~> 3.4'
s.add_development_dependency 'yard', '~> 0.8'
s.add_development_dependency 'rubocop', '~> 0.51.0'
s.add_development_dependency 'yard', '~> 0.9.11'
end