sensu-plugin 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,8 +49,8 @@ module Sensu
49
49
  @event['occurrences'] ||= 1
50
50
  @event['check'] ||= Hash.new
51
51
  @event['client'] ||= Hash.new
52
- rescue
53
- puts 'Error reading event'
52
+ rescue => e
53
+ puts 'Error reading event: ' + e.message
54
54
  exit 0
55
55
  end
56
56
  end
@@ -89,7 +89,7 @@ module Sensu
89
89
  end
90
90
  if @event['occurrences'] > occurrences
91
91
  n = refresh.fdiv(interval).to_i
92
- bail 'only repeating alert every' + n + 'occurrences' unless @event['occurrences'] % n == 0
92
+ bail 'only repeating alert every ' + n.to_s + ' occurrences' unless @event['occurrences'] % n == 0
93
93
  end
94
94
  end
95
95
 
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  module Plugin
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  EXIT_CODES = {
5
5
  'OK' => 0,
6
6
  'WARNING' => 1,
@@ -6,6 +6,8 @@ module Sensu
6
6
  class CLI
7
7
  include Mixlib::CLI
8
8
 
9
+ attr_accessor :argv
10
+
9
11
  # Implementing classes should override this to produce appropriate
10
12
  # output for their handler.
11
13
 
@@ -45,7 +47,7 @@ module Sensu
45
47
  at_exit do
46
48
  begin
47
49
  check = @@autorun.new
48
- check.parse_options
50
+ check.argv = check.parse_options
49
51
  check.run
50
52
  rescue SystemExit => e
51
53
  exit e.status
@@ -40,4 +40,9 @@ class TestCheckExternal < MiniTest::Unit::TestCase
40
40
  assert $?.exitstatus == 1
41
41
  end
42
42
 
43
+ def test_argv
44
+ output = run_script '-o', 'foo'
45
+ assert $?.exitstatus == 0 && output.include?('argv = foo')
46
+ end
47
+
43
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-22 00:00:00.000000000 Z
12
+ date: 2011-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70106722973320 !ruby/object:Gem::Requirement
16
+ requirement: &70176373322360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70106722973320
24
+ version_requirements: *70176373322360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mixlib-cli
27
- requirement: &70106722972800 !ruby/object:Gem::Requirement
27
+ requirement: &70176373321840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70106722972800
35
+ version_requirements: *70176373321840
36
36
  description: Plugins and helper libraries for Sensu, a monitoring framework
37
37
  email:
38
38
  - decklin@red-bean.com