hawkular-client 4.0.0 → 4.1.0
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.
- checksums.yaml +4 -4
- data/CHANGES.rdoc +3 -0
- data/lib/hawkular/operations/operations_api.rb +36 -10
- data/lib/hawkular/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d77d09316e981da7ac6e3b388086113d124edd8
|
4
|
+
data.tar.gz: b68cd6c87554d6277d2f3f58c2ed58d7af667b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 401153f15fb3a7fb00414e9febdb8499521338607dd473880ff66dfca8c742b7f613f4517126210d6991dbf4f91478c2ad3a111ea0629e680978755b94707d1b
|
7
|
+
data.tar.gz: f90f8cc4c20d36967403fca69d68c438b7166deb11637c0daf72e375712e6db1527b2bb9bda777f29db7f3f68308ebfbe0cdc75c4355408189e6f41847f28400
|
data/CHANGES.rdoc
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
This document describes the relevant changes between releases of the
|
4
4
|
_hawkular-client_ project.
|
5
5
|
|
6
|
+
=== v 4.1.0
|
7
|
+
* Fixed binary data handling when invoking <em>Export JDR</em> on operations API.
|
8
|
+
* Added <em>delete_immediately</em> parameter to <em>Export JDR</em> operation.
|
6
9
|
|
7
10
|
=== v 4.0.0
|
8
11
|
* Standardized Exceptions under the Hawkular namespace, and the old names were deprecated, here is the list:
|
@@ -28,14 +28,40 @@ module Hawkular::Operations
|
|
28
28
|
include WebSocket::Client
|
29
29
|
include MonitorMixin
|
30
30
|
|
31
|
-
attr_accessor :ws, :
|
31
|
+
attr_accessor :ws, :logger
|
32
32
|
|
33
33
|
# helper for parsing the "OperationName=json_payload" messages
|
34
34
|
class WebSocket::Frame::Data
|
35
35
|
def to_msg_hash
|
36
|
-
|
36
|
+
operation_name, json = split('=', 2)
|
37
|
+
|
38
|
+
# Check if there is a zip file following JSON.
|
39
|
+
# This check is done only in the first 100KB, hoping it's unlikely to
|
40
|
+
# have such large amount of JSON before a zip file is attached.
|
41
|
+
magic_bits = [
|
42
|
+
"\x50\x4B\x03\x04", # "PK" + 0x03 + 0x04 = Regular ZIP file
|
43
|
+
"\x50\x4B\x05\x06", # "PK" + 0x05 + 0x06 = Empty ZIP
|
44
|
+
"\x50\x4B\x07\x08" # "PK" + 0x07 + 0x08 = Spanned ZIP
|
45
|
+
]
|
46
|
+
search_chunk = json[0, 102_400]
|
47
|
+
zip_file = nil
|
48
|
+
|
49
|
+
magic_bits.each do |bits|
|
50
|
+
idx = search_chunk.index(bits)
|
51
|
+
|
52
|
+
next unless idx
|
53
|
+
|
54
|
+
zip_file = json[idx..-1]
|
55
|
+
json = json[0, idx]
|
56
|
+
break
|
57
|
+
end
|
58
|
+
|
59
|
+
# Parse JSON and, if received, attach zip file
|
60
|
+
json = JSON.parse(json)
|
61
|
+
json[:attachments] = zip_file
|
37
62
|
|
38
|
-
|
63
|
+
# Return processed data
|
64
|
+
{ operationName: operation_name, data: json }
|
39
65
|
rescue
|
40
66
|
{}
|
41
67
|
end
|
@@ -105,12 +131,8 @@ module Hawkular::Operations
|
|
105
131
|
client.on(:message, once: true) do |msg|
|
106
132
|
parsed_message = msg.data.to_msg_hash
|
107
133
|
|
134
|
+
logger = Hawkular::Logger.new
|
108
135
|
logger.log("Sent WebSocket message: #{parsed_message}")
|
109
|
-
|
110
|
-
case parsed_message[:operationName]
|
111
|
-
when 'WelcomeResponse'
|
112
|
-
@session_id = parsed_message[:data]['sessionId']
|
113
|
-
end
|
114
136
|
end
|
115
137
|
end
|
116
138
|
|
@@ -304,12 +326,16 @@ module Hawkular::Operations
|
|
304
326
|
# Exports the JDR report
|
305
327
|
#
|
306
328
|
# @param [String] resource_path canonical path of the WildFly server
|
329
|
+
# @param [Boolean] delete_immediately specifies whether the temporary file at the remote
|
330
|
+
# server should be deleted. False, by default.
|
307
331
|
# @param callback [Block] callback that is run after the operation is done
|
308
|
-
def export_jdr(resource_path, &callback)
|
332
|
+
def export_jdr(resource_path, delete_immediately = false, &callback)
|
309
333
|
fail Hawkular::ArgumentError, 'resource_path must be specified' if resource_path.nil?
|
310
334
|
check_pre_conditions(&callback)
|
311
335
|
|
312
|
-
invoke_specific_operation({ resourcePath: resource_path
|
336
|
+
invoke_specific_operation({ resourcePath: resource_path,
|
337
|
+
deleteImmediately: delete_immediately },
|
338
|
+
'ExportJdr', &callback)
|
313
339
|
end
|
314
340
|
|
315
341
|
# Updates the collection intervals.
|
data/lib/hawkular/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hawkular-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Libor Zoubek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
@@ -117,14 +117,14 @@ dependencies:
|
|
117
117
|
requirements:
|
118
118
|
- - '='
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.0
|
120
|
+
version: 0.1.0
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - '='
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0.0
|
127
|
+
version: 0.1.0
|
128
128
|
- !ruby/object:Gem::Dependency
|
129
129
|
name: yard
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
279
|
version: '0'
|
280
280
|
requirements: []
|
281
281
|
rubyforge_project:
|
282
|
-
rubygems_version: 2.6.
|
282
|
+
rubygems_version: 2.6.11
|
283
283
|
signing_key:
|
284
284
|
specification_version: 4
|
285
285
|
summary: A Ruby client for Hawkular
|