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

Feature/rubocop and sensu plugin #15

Merged
merged 2 commits into from
Dec 11, 2017
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ deploy:
provider: rubygems
api_key:
secure: qFtQsZUvfs7kpE2nMfFlBMhYkEfsn6F1k1iXsi68kqRGm1kgv1BhSVhnzvkeD7BM8ZykQNrRaXnod4WHdelwvBoXghjczKNCO0OzyskQEBB0BFHc/Ipn3bl1lJxe7ka+ks8M0wdEJPAbhPncAsLVE3H3do0uby2dLCL87KGrv1OC2VOxLbQjl+lLAK44+Qxzm39wbxJJmdZGIBPjGXRp1DnDroOrXwRgpGZ9LvtuMD5Zpu6FFoxh0S/0Xw9M7Y70V5Zy51NZ3NQn/o+iVp9Lib/w62sRWyhMBvhg0QHJYSn+CoZCpHhOgc3sHzPFTy3OI0fkh9rxmFPYpvI4Mw5U9KngTYf941Rr3SzkjA7v/+zCbfHI9JnzB9E5ndTxbSweh4IG+MI+1xspPORIBKRLOv/rYMo8XgiUplqqB/StW6fz3psIA88Q9N7X02l12pOPX5BHfsxk/c3BO/jNUUWnH9V62N+DLoHJ5My8RLLGw2jpb6Ln/8RPg2HxwwTEaWb7j9+F/ZhSnQ7zPaxGHu1Da/w2dBWGwvFxwVgGM7OXUhq3Cv4iSoupzekFfmdn3SQTSq4ZExlWgUlzwgfTM3Q8OKIcWJv/J81NYXBpu3EwssxN2zD3tw4EySxstlN5FU9H5aqFWMK4NPrz7Hcl0mUOJHKIl/UmuqmRzPR0/8NI9iQ=
gem: sensu-plugins-storm
gem: sensu-plugins-azurerm
on:
tags: true
rvm: 2.1
rvm: 2.2
rvm: 2.3.0
rvm: 2.4.1
repo: tombuildsstuff/sensu-plugins-azurerm
repo: sensu-plugins/sensu-plugins-azurerm
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ This CHANGELOG follows the format located [here](https://github.com/sensu-plugin

## [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
- bumped dependency of `sensu-plugin` to 2.x you can read about it [here](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29) (@majormoses)

### Fixed
- updated missed refs in `.travis.yml` to old repo (@majormoses)


## [1.0.0] - 2017-12-10
### Changed
- changelog gudelines location (@majormoses)
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ require 'English'
require 'kitchen/rake_tasks'

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 Down Expand Up @@ -45,5 +45,5 @@ Kitchen::RakeTasks.new
desc 'Alias for kitchen:all'
task integration: 'kitchen:all'

task default: %i(spec make_bin_executable yard rubocop check_binstubs integration)
task quick: %i(make_bin_executable yard rubocop check_binstubs)
task default: %i[spec make_bin_executable yard rubocop check_binstubs integration]
task quick: %i[make_bin_executable yard rubocop check_binstubs]
3 changes: 1 addition & 2 deletions bin/check-azurerm-core-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-d-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-ds-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-dsv2-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-dv2-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-f-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-cores-fs-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-load-balancers-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-network-interfaces-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-network-security-groups-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-public-ip-addresses-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-route-tables-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-service-bus-subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def run
else
ok "Subscription '#{config[:subscription_name]}' was found in topic '#{config[:topic_name]}'"
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-service-bus-topic-size.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-static-public-ip-addresses-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-virtual-machines-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
5 changes: 2 additions & 3 deletions bin/check-azurerm-virtual-network-gateway-connected.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,12 @@ def run
inbound = result.ingress_bytes_transferred
outbound = result.egress_bytes_transferred
message = "State is '#{connection_state}'. Usage is #{inbound} in / #{outbound} out"
if result.connection_status.casecmp('connected') == 0
if result.connection_status.casecmp('connected').zero?
ok message
else
critical message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,13 @@ def run
message = "Primary: State is '#{primary_connection_state}'. Usage is #{primary_inbound} in / #{primary_outbound} out.\n"
message += "Secondary: State is '#{secondary_connection_state}'. Usage is #{secondary_inbound} in / #{secondary_outbound} out."

if primary_result.connection_status.casecmp('connected') == 0 ||
secondary_result.connection_status.casecmp('connected') == 0
if primary_result.connection_status.casecmp('connected').zero? ||
secondary_result.connection_status.casecmp('connected').zero?
ok message
else
critical message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
3 changes: 1 addition & 2 deletions bin/check-azurerm-virtual-networks-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def run
else
ok message
end

rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def run

output metric_name, count, timestamp
ok
rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
2 changes: 1 addition & 1 deletion bin/metric-azurerm-virtual-network-gateway-usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run
output inbound_name, inbound, timestamp
output outbound_name, outbound, timestamp
ok
rescue => e
rescue StandardError => e
puts "Error: exception: #{e}"
critical
end
Expand Down
8 changes: 4 additions & 4 deletions sensu-plugins-azurerm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'date'
require './lib/sensu-plugins-azurerm.rb'

Gem::Specification.new do |s|
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
s.authors = ['Tom Harvey']
s.date = Date.today.to_s
s.description = 'This plugin provides checks for Microsoft Azure\'s Resource Manager service.'
s.email = '<[email protected]>'
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/tombuildsstuff/sensu-plugins-azurerm'
s.license = 'MIT'
s.metadata = { 'maintainer' => 'Tom Harvey',
Expand All @@ -31,7 +31,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'azure_mgmt_network', '0.8.0'
s.add_runtime_dependency 'azure_mgmt_service_bus', '0.8.0'
s.add_runtime_dependency 'ms_rest_azure', '~> 0.6.2'
s.add_runtime_dependency 'sensu-plugin', '~> 1.3'
s.add_runtime_dependency 'sensu-plugin', '~> 2.0'

s.add_development_dependency 'bundler', '~> 1.7'
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
Expand All @@ -44,7 +44,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake', '~> 10.5'
s.add_development_dependency 'redcarpet', '~> 3.2'
s.add_development_dependency 'rspec', '~> 3.4'
s.add_development_dependency 'rubocop', '~> 0.40.0'
s.add_development_dependency 'rubocop', '~> 0.51.0'
s.add_development_dependency 'serverspec', '~> 2.36.1'
s.add_development_dependency 'test-kitchen', '~> 1.6'
s.add_development_dependency 'yard', '~> 0.8'
Expand Down