sensu-plugin 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 439e62345fbca9abbb87caefb2dab6fe8c6fe27a
4
- data.tar.gz: a69c05b54b7b880349cfe8a3c7b5a049a55d95c1
3
+ metadata.gz: 5fa20b06e805a4910513f35e0d49e04190c04618
4
+ data.tar.gz: 875707ed61b5a30a87aa13350f857d6836582fad
5
5
  SHA512:
6
- metadata.gz: 778655e4423a395515e033fcc50978e49faba9592b2765bca4a4f701525bfe52060652deeca4ebb2677cdf098028261c44939eec89ec17bbeed51754d517cd0d
7
- data.tar.gz: a90220148e575a88eb20b8ec8b0fb60efc32284ba1ac87927f84db986b9a1bb86e8b2b56fa78677ca66d4b4568631f806ad81419fb24343f7c0892fed75059fe
6
+ metadata.gz: d7d2b872c3322ccc4e43e56329a54b3e9fba0cdae70ed9fadcadc1276ff82e12108c6bc297e668c81ca97dfb8bcf212903b5cd4192399c2047829de316c93c04
7
+ data.tar.gz: bee33bfaee01fe9f133c2f92699e80e1bea059117952085afbe3ece721bb7d3072b85742e5204110c6e7966509de03561dc271dfafe094072cd3a6e1d23915a9
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  module Plugin
3
- VERSION = "2.0.2"
3
+ VERSION = "2.1.0"
4
4
  EXIT_CODES = {
5
5
  'OK' => 0,
6
6
  'WARNING' => 1,
@@ -61,6 +61,17 @@ module Sensu
61
61
  end
62
62
  merged
63
63
  end
64
+
65
+ def cast_bool_values_int(value)
66
+ case value
67
+ when 'true', true
68
+ 1
69
+ when 'false', false
70
+ 0
71
+ else
72
+ value
73
+ end
74
+ end
64
75
  end
65
76
  end
66
77
  end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+ require 'sensu-plugin/utils'
3
+
4
+ class TestCastBoolInt < MiniTest::Test
5
+ include SensuPluginTestHelper
6
+ include Sensu::Plugin::Utils
7
+
8
+ def test_integer
9
+ assert_equal 567.89, cast_bool_values_int(567.89)
10
+ end
11
+
12
+ def test_false_boolean
13
+ assert_equal 0, cast_bool_values_int(false)
14
+ end
15
+
16
+ def test_true_boolean
17
+ assert_equal 1, cast_bool_values_int(true)
18
+ end
19
+
20
+ def test_false_string
21
+ assert_equal 0, cast_bool_values_int('false')
22
+ end
23
+
24
+ def test_true_string
25
+ assert_equal 1, cast_bool_values_int('true')
26
+ end
27
+
28
+ def test_arbirtrary_string
29
+ assert_equal 'foo', cast_bool_values_int('foo')
30
+ end
31
+ 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: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Decklin Foster
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-20 00:00:00.000000000 Z
12
+ date: 2017-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -29,16 +29,16 @@ dependencies:
29
29
  name: mixlib-cli
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '1.5'
34
+ version: 1.5.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '1.5'
41
+ version: 1.5.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +82,7 @@ files:
82
82
  - lib/sensu-plugin/cli.rb
83
83
  - lib/sensu-plugin/metric/cli.rb
84
84
  - lib/sensu-plugin/utils.rb
85
+ - test/cast_bool_value_test.rb
85
86
  - test/deep_merge_test.rb
86
87
  - test/external_check_test.rb
87
88
  - test/external_handler_argument_test.rb
@@ -111,17 +112,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  requirements: []
113
114
  rubyforge_project:
114
- rubygems_version: 2.6.11
115
+ rubygems_version: 2.4.5.1
115
116
  signing_key:
116
117
  specification_version: 4
117
118
  summary: Sensu Plugins
118
119
  test_files:
119
- - test/external_check_test.rb
120
120
  - test/handle_helper_test.rb
121
+ - test/external_handler_test.rb
121
122
  - test/external_metric_test.rb
122
123
  - test/handle_filter_test.rb
124
+ - test/external_check_test.rb
125
+ - test/external_handler_argument_test.rb
126
+ - test/cast_bool_value_test.rb
123
127
  - test/deep_merge_test.rb
124
128
  - test/mutator_test.rb
125
129
  - test/test_helper.rb
126
- - test/external_handler_argument_test.rb
127
- - test/external_handler_test.rb