arborist-webservice 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +49 -2
- data/History.md +15 -0
- data/lib/arborist/monitor/webservice.rb +11 -11
- data/lib/arborist/node/webservice.rb +1 -1
- data/lib/arborist/webservice.rb +2 -2
- data/spec/arborist/monitor/webservice_spec.rb +3 -3
- data/spec/arborist/node/webservice_spec.rb +7 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9074057038e73d8e0ece407edd5dadd634c65e068a9c88b1f96559cf5638ac3f
|
4
|
+
data.tar.gz: 404d121137779059274aced0add2b36dbac8d3c868530a2564a0e7b13a3355be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77063a8daa6787169e5249187e79d05fa4abc10c84504ce2a47d5c2669247ebdb14314d4c1681392e2d5606f60fd88781e2d4fec9cf61a77fd56a95d21dc0756
|
7
|
+
data.tar.gz: c624e285ac468e8627b0fa5040ebc510cbdc5c510961bd1fe37962d1028ab15c976ede1a5a2dcb9a922ff4c874375535571fd54c8b669be3b04d3c53cb3d8ef5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,8 +1,55 @@
|
|
1
|
+
2018-09-03 Mahlon E. Smith <mahlon@martini.nu>
|
2
|
+
|
3
|
+
* lib/arborist/monitor/webservice.rb,
|
4
|
+
spec/arborist/monitor/webservice_spec.rb:
|
5
|
+
Always request 'expected_status' from the node when monitoring.
|
6
|
+
[ba3b0f990a97] [github/master, tip]
|
7
|
+
|
8
|
+
* lib/arborist/node/webservice.rb,
|
9
|
+
spec/arborist/node/webservice_spec.rb:
|
10
|
+
Allow method symbols or strings.
|
11
|
+
[2c0f5b6ec7ed]
|
12
|
+
|
13
|
+
* lib/arborist/monitor/webservice.rb:
|
14
|
+
Pass the entire node into #make_response_results, so child classes
|
15
|
+
that override this method have all the node information at their
|
16
|
+
disposal.
|
17
|
+
[0bbbc289d9af]
|
18
|
+
|
19
|
+
* spec/arborist/node/webservice_spec.rb:
|
20
|
+
Test shorthand node URI syntax with a port, too
|
21
|
+
[5eb19864f76f]
|
22
|
+
|
23
|
+
2018-09-03 Mahlon E. Smith <mahlon@laika.com>
|
24
|
+
|
25
|
+
* spec/arborist/monitor/webservice_spec.rb:
|
26
|
+
Fix tests.
|
27
|
+
[339e7709deca]
|
28
|
+
|
29
|
+
2018-08-30 Mahlon E. Smith <mahlon@martini.nu>
|
30
|
+
|
31
|
+
* lib/arborist/monitor/webservice.rb:
|
32
|
+
... and do the same for timeout messages, including the current
|
33
|
+
value.
|
34
|
+
[c27a86bfa110]
|
35
|
+
|
36
|
+
* lib/arborist/monitor/webservice.rb:
|
37
|
+
Reuse the 'nicer' error message for the node state message.
|
38
|
+
[2e655e5843de]
|
39
|
+
|
1
40
|
2018-08-30 Michael Granger <ged@FaerieMUD.org>
|
2
41
|
|
42
|
+
* .hgtags:
|
43
|
+
Added tag v0.0.1 for changeset ed8ca51f19e8
|
44
|
+
[be250f639097]
|
45
|
+
|
46
|
+
* .hgsigs:
|
47
|
+
Added signature for changeset 65c19b823a1b
|
48
|
+
[ed8ca51f19e8] [v0.0.1]
|
49
|
+
|
3
50
|
* History.md, arborist-webservice.gemspec:
|
4
51
|
Update history and the gemspec
|
5
|
-
[65c19b823a1b]
|
52
|
+
[65c19b823a1b]
|
6
53
|
|
7
54
|
* README.md, lib/arborist/monitor/webservice.rb,
|
8
55
|
lib/arborist/node/webservice.rb,
|
@@ -18,7 +65,7 @@
|
|
18
65
|
* lib/arborist/monitor/webservice.rb,
|
19
66
|
spec/arborist/monitor/webservice_spec.rb:
|
20
67
|
Rename 'HTML' monitor callback to 'HTTP'
|
21
|
-
[c970fb9b5ccf]
|
68
|
+
[c970fb9b5ccf]
|
22
69
|
|
23
70
|
2018-08-15 Michael Granger <ged@FaerieMUD.org>
|
24
71
|
|
data/History.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## v0.1.0 [2018-09-03] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Bugfixes:
|
4
|
+
|
5
|
+
- Always request 'expected_status' from the node when monitoring.
|
6
|
+
- Allow HTTP method to be either a symbol or a string.
|
7
|
+
|
8
|
+
Enhancements:
|
9
|
+
|
10
|
+
- Make error messages nicer.
|
11
|
+
- Support shorthand URI syntax to automatically use the containing
|
12
|
+
host's first IP.
|
13
|
+
- Improve the ability to override behavior of the HTTP monitor
|
14
|
+
|
15
|
+
|
1
16
|
## v0.0.1 [2018-08-30] Michael Granger <ged@FaerieMUD.org>
|
2
17
|
|
3
18
|
Initial release.
|
@@ -61,7 +61,7 @@ module Arborist::Monitor::Webservice
|
|
61
61
|
}
|
62
62
|
|
63
63
|
# The array of node properites used by this monitor
|
64
|
-
NODE_PROPERTIES = %i[ uri http_method body body_mimetype config ].freeze
|
64
|
+
NODE_PROPERTIES = %i[ uri expected_status http_method body body_mimetype config ].freeze
|
65
65
|
|
66
66
|
|
67
67
|
### Return an array of attributes to fetch from nodes for this monitor.
|
@@ -112,7 +112,7 @@ module Arborist::Monitor::Webservice
|
|
112
112
|
request.on_complete do |response|
|
113
113
|
self.log.debug "Handling response for %s" % [ identifier ]
|
114
114
|
results[ identifier ] =
|
115
|
-
self.make_response_results( response, node
|
115
|
+
self.make_response_results( response, node )
|
116
116
|
end
|
117
117
|
hydra.queue( request )
|
118
118
|
end
|
@@ -184,21 +184,21 @@ module Arborist::Monitor::Webservice
|
|
184
184
|
|
185
185
|
|
186
186
|
### Return a Hash of results appropriate for the specified +response+.
|
187
|
-
def make_response_results( response,
|
188
|
-
if response.code == expected_status
|
187
|
+
def make_response_results( response, node )
|
188
|
+
if response.code == node[ 'expected_status' ]
|
189
189
|
return { webservice: self.success_results(response) }
|
190
190
|
elsif response.timed_out?
|
191
|
-
|
192
|
-
|
191
|
+
errmsg = "Request timed out after %0.1f seconds." % [ self.timeout ]
|
192
|
+
self.log.error( errmsg )
|
193
|
+
return { error: errmsg }
|
193
194
|
elsif response.code == 0
|
194
195
|
self.log.error( response.return_message )
|
195
196
|
return { error: response.return_message }
|
196
197
|
else
|
197
|
-
|
198
|
-
[ response.code, response.status_message, expected_status ]
|
199
|
-
|
200
|
-
|
201
|
-
}
|
198
|
+
errmsg = "Got an unexpected %03d %s response; expected %03d." %
|
199
|
+
[ response.code, response.status_message, node['expected_status'] ]
|
200
|
+
self.log.error( errmsg )
|
201
|
+
return { error: errmsg }
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
@@ -106,7 +106,7 @@ class Arborist::Node::Webservice < Arborist::Node::Service
|
|
106
106
|
when 'uri'
|
107
107
|
URI( self.uri ) == URI( val )
|
108
108
|
when 'http_method'
|
109
|
-
self.http_method == val
|
109
|
+
self.http_method.to_s == val
|
110
110
|
when 'http_version'
|
111
111
|
self.http_version == val
|
112
112
|
when 'expected_status'
|
data/lib/arborist/webservice.rb
CHANGED
@@ -14,10 +14,10 @@ module Arborist::Webservice
|
|
14
14
|
|
15
15
|
|
16
16
|
# Package version
|
17
|
-
VERSION = '0.0
|
17
|
+
VERSION = '0.1.0'
|
18
18
|
|
19
19
|
# Version control revision
|
20
|
-
REVISION = %q$Revision:
|
20
|
+
REVISION = %q$Revision: b5c6af551f6c $
|
21
21
|
|
22
22
|
|
23
23
|
### Return the name of the library with the version, and optionally the build ID if
|
@@ -36,7 +36,7 @@ describe Arborist::Monitor::Webservice do
|
|
36
36
|
let( :nodes ) {[ webservice_node1, webservice_node2, webservice_node3 ]}
|
37
37
|
let( :nodes_hash ) do
|
38
38
|
nodes.each_with_object({}) do |node, accum|
|
39
|
-
accum[ node.identifier ] = node.fetch_values
|
39
|
+
accum[ node.identifier ] = node.fetch_values( described_class.node_properties.map( &:to_s ) )
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -75,7 +75,7 @@ describe Arborist::Monitor::Webservice do
|
|
75
75
|
|
76
76
|
result = monitor.run( nodes_hash )
|
77
77
|
|
78
|
-
expect( result[webservice_node3.identifier] ).to include( error:
|
78
|
+
expect( result[webservice_node3.identifier] ).to include( error: /Got an unexpected 500 Server Error/ )
|
79
79
|
end
|
80
80
|
|
81
81
|
|
@@ -103,7 +103,7 @@ describe Arborist::Monitor::Webservice do
|
|
103
103
|
|
104
104
|
result = monitor.run( nodes_hash )
|
105
105
|
|
106
|
-
expect( result[webservice_node2.identifier] ).to include( error:
|
106
|
+
expect( result[webservice_node2.identifier] ).to include( error: /Request timed out after/ )
|
107
107
|
end
|
108
108
|
|
109
109
|
|
@@ -20,7 +20,7 @@ describe Arborist::Node::Webservice do
|
|
20
20
|
let( :node ) { host_node.webservice('api', 'https://example.com/api/v1') }
|
21
21
|
let( :getonly_node ) do
|
22
22
|
host_node.webservice( 'repo-api', 'https://repo.example.com/' ) do
|
23
|
-
http_method
|
23
|
+
http_method :GET
|
24
24
|
end
|
25
25
|
end
|
26
26
|
let( :http10_node ) do
|
@@ -70,5 +70,11 @@ describe Arborist::Node::Webservice do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
|
+
it "allows shorthand URI syntax with a port for implicit host" do
|
74
|
+
node = host_node.webservice( 'djinn', 'http://:8080/' )
|
75
|
+
expect( node.uri ).to eq( 'http://192.168.66.12:8080/' )
|
76
|
+
end
|
77
|
+
|
78
|
+
|
73
79
|
end
|
74
80
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arborist-webservice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
36
36
|
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-
|
38
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: arborist
|
metadata.gz.sig
CHANGED
Binary file
|