brpm_module_bladelogic 0.1.38 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/automations/execute_job.rb +64 -39
- data/config.yml +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTlhYjkyZjQ0YTIxZmQ1NjVlNmU5NGE1NjlkN2RhYmYzYmE5MDcxNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQ0MjJhYjMwYmNkZjc5N2Q1ZWE0MTc0ZDk4MzBjNjUyN2JiODYyNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2Y0ZGVkODFhMGM1NmFlNzRmN2RhZDYzNTFlNmUwN2MzYzljMDcwMTg3Y2Fh
|
10
|
+
NzAxZDZkYzlmNGMzZjA4NzUxMTdiZmJjOTM1YmU1NmZkYTZmY2E3YzlmZTMy
|
11
|
+
MzcyNWViNmNlYTA1NmYzNjg5OGJlNGMzYWRjZjA5YzA2Y2JmYWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTU2MzIwMjk2YmZmNDBlMWUxMDRiN2Y2ODBhM2JmZTBjOTc2OTkyODU2YzUw
|
14
|
+
NWY5MDQ0NGNmZTQ3MWI1YjEyOTExMDE2YjcyNDFkY2YxZTAxNjk4OWI4Zjdl
|
15
|
+
NjczNzcxMjRmYjNlNTM1ZWFjOWY3OTUxYTdkYjM1Y2NkYjg2YzQ=
|
data/automations/execute_job.rb
CHANGED
@@ -12,42 +12,6 @@ class String
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def pack_response_for_result_summaries(csv_content)
|
16
|
-
logs = csv_content[6..-1] # remove the headers of the csv file
|
17
|
-
|
18
|
-
logs = logs.select { |log| !log[0].start_with?("Run at") }
|
19
|
-
|
20
|
-
logs.each do |log|
|
21
|
-
log[2] = DateTime.parse(log[2])
|
22
|
-
end
|
23
|
-
|
24
|
-
logs = logs.sort_by { |log| [log[0], log[2]] }
|
25
|
-
|
26
|
-
servers_with_logs = logs.group_by {|log| log[0] }
|
27
|
-
failed_servers_with_logs = servers_with_logs.select {|key, value| value.select{|log| log[1] == "Error"}.count>0}
|
28
|
-
|
29
|
-
BrpmAuto.pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
30
|
-
|
31
|
-
table_data = [[' ', 'Server', 'Result', 'Error message']]
|
32
|
-
counter = 0
|
33
|
-
server_cache = ""
|
34
|
-
logs.select{|log| log[1] == "Error"}.each do |log|
|
35
|
-
if log[0] == server_cache
|
36
|
-
server = ""
|
37
|
-
else
|
38
|
-
server = log[0]
|
39
|
-
server_cache = log[0]
|
40
|
-
end
|
41
|
-
result = log[1]
|
42
|
-
message = log[3]
|
43
|
-
|
44
|
-
counter += 1
|
45
|
-
table_data << [counter, server, result, message]
|
46
|
-
end
|
47
|
-
|
48
|
-
BrpmAuto.pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
49
|
-
end
|
50
|
-
|
51
15
|
brpm_rest_client = BrpmRestClient.new
|
52
16
|
|
53
17
|
job_type_and_name = BrpmAuto.params["job_type_and_name"].split("|")
|
@@ -110,10 +74,71 @@ File.open(results_full_path, "w") do |f|
|
|
110
74
|
f.puts(results_content)
|
111
75
|
end
|
112
76
|
|
113
|
-
|
77
|
+
BrpmAuto.log("Parsing the results...")
|
78
|
+
# As this export contains "embedded" double quotes it is not possible to parse it with the CSV library
|
79
|
+
log_lines = results_content.split("\n")[6..-1]
|
80
|
+
log_lines.select! { |log| !log.start_with?("run level log,") }
|
81
|
+
|
82
|
+
logs = log_lines.map do |log_line|
|
83
|
+
log_items = log_line.split(",",7)
|
84
|
+
|
85
|
+
# 0: server
|
86
|
+
# 1: phase
|
87
|
+
# 2: attempt
|
88
|
+
# 3: date part 1
|
89
|
+
# 4: date part 2
|
90
|
+
# 5: Info - Warning - Error
|
91
|
+
# 6: message
|
92
|
+
|
93
|
+
if log_items.count < 7 # Some lines are broken in two because of end-of-lines appearing in the message field...
|
94
|
+
nil
|
95
|
+
else
|
96
|
+
log_items[6] = log_items[6].tr(",,","")
|
97
|
+
log_items[3] = DateTime.parse("#{log_items[3]},#{log_items[4]}")
|
98
|
+
|
99
|
+
log_items
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
logs = logs.compact # removing the possible nils from the array
|
104
|
+
|
105
|
+
logs = logs.sort_by { |log| [log[0], log[1], log[3]] }
|
106
|
+
|
107
|
+
servers_with_logs = logs.group_by { |log| log[0] }
|
108
|
+
|
109
|
+
failed_servers_with_logs = servers_with_logs.select { |key, value| value.select{|log| log[5] == "Error" }.count > 0}
|
110
|
+
|
111
|
+
BrpmAuto.pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
112
|
+
|
113
|
+
table_data = [[' ', 'Server', 'Simulate', 'Stage', 'Commit']]
|
114
|
+
counter = 0
|
115
|
+
servers_with_logs.each do |key, logs|
|
116
|
+
server = key
|
117
|
+
|
118
|
+
phase_with_logs = logs.group_by { |log| log[1] }
|
119
|
+
|
120
|
+
if phase_with_logs.has_key?("Simulate")
|
121
|
+
simulate = phase_with_logs["Simulate"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
122
|
+
else
|
123
|
+
simulate = ""
|
124
|
+
end
|
125
|
+
if phase_with_logs.has_key?("Stage")
|
126
|
+
stage = phase_with_logs["Stage"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
127
|
+
else
|
128
|
+
stage = ""
|
129
|
+
end
|
130
|
+
if phase_with_logs.has_key?("Commit")
|
131
|
+
commit = phase_with_logs["Commit"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
132
|
+
else
|
133
|
+
commit = ""
|
134
|
+
end
|
135
|
+
|
136
|
+
counter += 1
|
137
|
+
table_data << [counter, server, simulate, stage, commit]
|
138
|
+
end
|
114
139
|
|
115
|
-
|
140
|
+
BrpmAuto.pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
116
141
|
|
117
142
|
BrpmAuto.pack_response "results_link", results_full_path
|
118
143
|
|
119
|
-
raise "The job had errors!" if had_errors
|
144
|
+
raise "The Deploy job had errors!" if had_errors
|
data/config.yml
CHANGED