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

[CVE-2017-8418] - updating rubocop dependency. #10

Merged
merged 1 commit into from
Jan 23, 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: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ cache:
install:
- bundle install
rvm:
- 2.0
- 2.1
- 2.2
- 2.3.0
Expand All @@ -27,7 +26,6 @@ deploy:
on:
tags: true
all_branches: true
rvm: 2.0
rvm: 2.1
rvm: 2.2
rvm: 2.3.0
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang

## [Unreleased]

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

### Breaking Changes
- in order to bring in new rubocop dependency we need to drop ruby 2.0 support as it is EOL and aligns with out support policy. (@majormoses)

## [1.1.0] 2017-07-26
### Added
- Test Ruby 2.4.1 (@thomasriley)
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require 'yard'
require 'yard/rake/yardoc_task'

YARD::Rake::YardocTask.new do |t|
OTHER_PATHS = %w().freeze
OTHER_PATHS = %w[].freeze
t.files = ['lib/**/*.rb', 'bin/**/*.rb', OTHER_PATHS]
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md)
t.options = %w[--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md]
end

RuboCop::RakeTask.new
Expand All @@ -35,4 +35,4 @@ task :check_binstubs do
end
end

task default: [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
task default: %i[spec make_bin_executable yard rubocop check_binstubs]
21 changes: 11 additions & 10 deletions bin/metrics-cassandra-graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,29 +189,30 @@ def nodetool_cmd(cmd)
# According to io/util/FileUtils.java units for load are:
# TB/GB/MB/KB/bytes
#
def parse_info# rubocop:disable all
def parse_info
info = nodetool_cmd('info')
# #YELLOW
info.each_line do |line|
if m = line.match(/^Exceptions\s*:\s+([0-9]+)$/)# rubocop:disable all
# TODO: come back and refactor me to be better
info.each_line do |line| # rubocop:disable Metrics/BlockLength
if m == line.match(/^Exceptions\s*:\s+([0-9]+)$/)
output "#{config[:scheme]}.exceptions", m[1], @timestamp
end

if m = line.match(/^Load\s*:\s+([0-9.]+)\s+([KMGT]i?B|bytes)$/)# rubocop:disable all
if m =+ line.match(/^Load\s*:\s+([0-9.]+)\s+([KMGT]i?B|bytes)$/)# rubocop:disable all
output "#{config[:scheme]}.load", convert_to_bytes(m[1], m[2]), @timestamp
end

if m = line.match(/^Uptime[^:]+:\s+(\d+)$/)# rubocop:disable all
if m == line.match(/^Uptime[^:]+:\s+(\d+)$/)
output "#{config[:scheme]}.uptime", m[1], @timestamp
end

if m = line.match(/^Heap Memory[^:]+:\s+([0-9.]+)\s+\/\s+([0-9.]+)$/)# rubocop:disable all
if m == line.match(/^Heap Memory[^:]+:\s+([0-9.]+)\s+\/\s+([0-9.]+)$/)# rubocop:disable all
output "#{config[:scheme]}.heap.used", convert_to_bytes(m[1], 'MB'), @timestamp
output "#{config[:scheme]}.heap.total", convert_to_bytes(m[2], 'MB'), @timestamp
end

# v1.1+
if m = line.match(/^Key Cache[^:]+: size ([0-9]+) \(bytes\), capacity ([0-9]+) \(bytes\), ([0-9]+) hits, ([0-9]+) requests/)# rubocop:disable all
if m == line.match(/^Key Cache[^:]+: size ([0-9]+) \(bytes\), capacity ([0-9]+) \(bytes\), ([0-9]+) hits, ([0-9]+) requests/)# rubocop:disable all
output "#{config[:scheme]}.key_cache.size", m[1], @timestamp
output "#{config[:scheme]}.key_cache.capacity", m[2], @timestamp
output "#{config[:scheme]}.key_cache.hits", m[3], @timestamp
Expand All @@ -221,15 +222,15 @@ def parse_info# rubocop:disable all
# cassandra nodetool v3.0+ Changed the key cache output
# Key Cache : entries 569669, size 100 MiB, capacity 100 MiB, 35689224 hits, 70654365 requests, 0.505 recent hit rate, 14400 save period in seconds
# Key Cache : entries 13291, size 7.83 MB, capacity 50 MB, 119444 hits, 139720 requests, 0.855 recent hit rate, 14400 save period in seconds
if m = line.match(/^Key Cache[^:]+: entries ([0-9]+), size ([-+]?[0-9]*\.?[0-9]+) ([KMGT]i?B|bytes), capacity ([-+]?[0-9]*\.?[0-9]+) ([KMGT]i?B|bytes), ([0-9]+) hits, ([0-9]+) requests, ([-+]?[0-9]*\.?[0-9]+) recent hit rate/)# rubocop:disable all
if m == line.match(/^Key Cache[^:]+: entries ([0-9]+), size ([-+]?[0-9]*\.?[0-9]+) ([KMGT]i?B|bytes), capacity ([-+]?[0-9]*\.?[0-9]+) ([KMGT]i?B|bytes), ([0-9]+) hits, ([0-9]+) requests, ([-+]?[0-9]*\.?[0-9]+) recent hit rate/)# rubocop:disable all
output "#{config[:scheme]}.key_cache.size", convert_to_bytes(m[2], m[3]), @timestamp
output "#{config[:scheme]}.key_cache.capacity", convert_to_bytes(m[4], m[5]), @timestamp
output "#{config[:scheme]}.key_cache.hits", m[6], @timestamp
output "#{config[:scheme]}.key_cache.requests", m[7], @timestamp
output "#{config[:scheme]}.key_cache.hit_rate", m[8], @timestamp
end

if m = line.match(/^Row Cache[^:]+: size ([0-9]+) \(bytes\), capacity ([0-9]+) \(bytes\), ([0-9]+) hits, ([0-9]+) requests/)# rubocop:disable all
if m == line.match(/^Row Cache[^:]+: size ([0-9]+) \(bytes\), capacity ([0-9]+) \(bytes\), ([0-9]+) hits, ([0-9]+) requests/)# rubocop:disable all
output "#{config[:scheme]}.row_cache.size", m[1], @timestamp
output "#{config[:scheme]}.row_cache.capacity", m[2], @timestamp
output "#{config[:scheme]}.row_cache.hits", m[3], @timestamp
Expand Down Expand Up @@ -362,7 +363,7 @@ def get_metric(string) # rubocop:disable NestedMethodDefinition
keyspace = m[1]
elsif m = line.match(/\t\tColumn Family[^:]*:\s+(\w+)$/)# rubocop:disable all
cf = m[1]
elsif num_indents == 0
elsif num_indents.zero?
# keyspace = nil
cf = nil
elsif num_indents == 2 && !cf.nil?
Expand Down
8 changes: 4 additions & 4 deletions sensu-plugins-cassandra.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'date'
require_relative 'lib/sensu-plugins-cassandra'

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 = 'This plugin provides native Cassandra
Expand All @@ -15,7 +15,7 @@ Gem::Specification.new do |s|
more.'
s.email = '<sensu-users@googlegroups.com>'
s.executables = Dir.glob('bin/**/*.rb').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-cassandra'
s.license = 'MIT'
s.metadata = { 'maintainer' => 'sensu-plugin',
Expand All @@ -27,7 +27,7 @@ Gem::Specification.new do |s|
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.1.0'
s.summary = 'Sensu plugins for the Cassandra NoSQL database server'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.version = SensuPluginsCassandra::Version::VER_STRING
Expand All @@ -42,6 +42,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'redcarpet', '~> 3.2'
s.add_development_dependency 'rspec', '~> 3.1'
s.add_development_dependency 'rubocop', '~> 0.40.0'
s.add_development_dependency 'rubocop', '~> 0.51.0'
s.add_development_dependency 'yard', '~> 0.8'
end