ruboty-lambda 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/handlers/lambda.rb +29 -1
- data/lib/ruboty/lambda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26047e1664fc9710deefe4ee95588bd01f69016c
|
4
|
+
data.tar.gz: acaf9269d8e503ae49b50486fd4919ad3690f962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103fc20943a9b24508c124c1a12d08f857c17c9ca50b31e9b23a6a097c165cea97c176bb5c25ab356c53c99b0b03b95ad24e202dd4d7067a3ce69afef816896c
|
7
|
+
data.tar.gz: ce8855da2c522c198e96dd6c6219e6c4828787dd7a3d4f9335828362fc1d866bfd7085ba8d6cedf74a4bfa46665f6c28ee8470e9cef388f795babee0f675a6f2
|
@@ -24,11 +24,39 @@ module Ruboty::Handlers
|
|
24
24
|
resp = aws_lambda.invoke({
|
25
25
|
function_name: fn,
|
26
26
|
invocation_type: "RequestResponse",
|
27
|
+
log_type: "Tail",
|
27
28
|
payload: json,
|
28
29
|
qualifier: "$LATEST",
|
29
30
|
})
|
30
31
|
|
31
|
-
|
32
|
+
result = Base64.decode64(resp.log_result)
|
33
|
+
log = []
|
34
|
+
attachments = []
|
35
|
+
|
36
|
+
result.each_line do |line|
|
37
|
+
case true
|
38
|
+
when line.start_with?('START', 'END')
|
39
|
+
next
|
40
|
+
when line.start_with?('REPORT')
|
41
|
+
line[7..-1].strip.split("\t").map {|f| f.split(':', 2).map(&:strip) }.each do |f|
|
42
|
+
attachments << {
|
43
|
+
title: f[0],
|
44
|
+
text: f[1],
|
45
|
+
short: true
|
46
|
+
}
|
47
|
+
end
|
48
|
+
else
|
49
|
+
field = line.split("\t")
|
50
|
+
log << "#{field[0]} #{field[2]}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
payload = resp.payload.read
|
55
|
+
attachments << {
|
56
|
+
title: "payload",
|
57
|
+
text: payload
|
58
|
+
}
|
59
|
+
message.reply(log.join("\n"), code: true, attachments: attachments)
|
32
60
|
end
|
33
61
|
|
34
62
|
private
|