brpm_module_bladelogic 0.1.39 → 0.1.41
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 +8 -8
- data/automations/execute_job.meta +1 -1
- data/automations/execute_job.rb +85 -49
- data/config.yml +1 -1
- data/tests/execute_job_spec.rb +16 -4
- data/tests/select_job_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWVkYjE0NzE2YjA1YTBmMDE3ZDAwMzQwODUzYWRhNDM2MGJlODllMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2QxZTJiNGI0YWYwZjM2OTllYjFjODg3OTljZWRkZmJlNzIzOWJiYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDg1OGFmYzJjNzQ3ZWI2MjI2ZTUwOTY1ZGI4NTkwMGE1Y2RmNmQyNjQ0MzRl
|
10
|
+
NmZmMzQwNGE3MGJlNGJmNGM5ZjgzODA0Y2RmZTI3MDA4YWRmZGY0MzhmY2Rj
|
11
|
+
ZGQ1NzAyNTU4ZjllZmJmYWRlNDZjNmM3ZTlkYTJlY2VlMDAzYzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTBhYTIxNjllZTQ0YTFiYzhhOTg2ZGUxNjYwMzE5MDc0NGUyNTcxZDE0NzYy
|
14
|
+
YTU3OGYzZjgxZDNlZmQ3OWU0YjRkM2U2MWFhOTUwN2RhNGFkMzNmNmQ3MjVk
|
15
|
+
YTI0ZTYwYTZjNWQ5OGM4NDU0YTcxMWRkNmNmOTQ1NzJlZjIwNjA=
|
data/automations/execute_job.rb
CHANGED
@@ -75,70 +75,106 @@ File.open(results_full_path, "w") do |f|
|
|
75
75
|
end
|
76
76
|
|
77
77
|
BrpmAuto.log("Parsing the results...")
|
78
|
-
|
79
|
-
|
80
|
-
log_lines
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
78
|
+
if job_type == "DeployJob"
|
79
|
+
# As this export contains "embedded" double quotes it is not possible to parse it with the CSV library
|
80
|
+
log_lines = results_content.split("\n")[6..-1]
|
81
|
+
log_lines.select! { |log| !log.start_with?("run level log,") }
|
82
|
+
|
83
|
+
logs = log_lines.map do |log_line|
|
84
|
+
log_items = log_line.split(",",7)
|
85
|
+
|
86
|
+
# 0: server
|
87
|
+
# 1: phase
|
88
|
+
# 2: attempt
|
89
|
+
# 3: date part 1
|
90
|
+
# 4: date part 2
|
91
|
+
# 5: Info - Warning - Error
|
92
|
+
# 6: message
|
93
|
+
|
94
|
+
if log_items.count < 7 # Some lines are broken in two because of end-of-lines appearing in the message field...
|
95
|
+
nil
|
96
|
+
else
|
97
|
+
log_items[6] = log_items[6].tr(",,","")
|
98
|
+
log_items[3] = DateTime.parse("#{log_items[3]},#{log_items[4]}")
|
99
|
+
|
100
|
+
log_items
|
101
|
+
end
|
100
102
|
end
|
101
|
-
end
|
102
103
|
|
103
|
-
logs = logs.compact # removing the possible nils from the array
|
104
|
+
logs = logs.compact # removing the possible nils from the array
|
104
105
|
|
105
|
-
logs = logs.sort_by { |log| [log[0], log[1], log[3]] }
|
106
|
+
logs = logs.sort_by { |log| [log[0], log[1], log[3]] }
|
106
107
|
|
107
|
-
servers_with_logs = logs.group_by { |log| log[0] }
|
108
|
+
servers_with_logs = logs.group_by { |log| log[0] }
|
108
109
|
|
109
|
-
failed_servers_with_logs = servers_with_logs.select { |key, value| value.select{|log| log[5] == "Error" }.count > 0}
|
110
|
+
failed_servers_with_logs = servers_with_logs.select { |key, value| value.select{|log| log[5] == "Error" }.count > 0}
|
110
111
|
|
111
|
-
BrpmAuto.pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
112
|
+
BrpmAuto.pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
112
113
|
|
113
|
-
table_data = [[' ', 'Server', 'Simulate', 'Stage', 'Commit']]
|
114
|
-
counter = 0
|
115
|
-
servers_with_logs.each do |key, logs|
|
116
|
-
|
114
|
+
table_data = [[' ', 'Server', 'Simulate', 'Stage', 'Commit']]
|
115
|
+
counter = 0
|
116
|
+
servers_with_logs.each do |key, logs|
|
117
|
+
server = key
|
117
118
|
|
118
|
-
|
119
|
+
phase_with_logs = logs.group_by { |log| log[1] }
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
121
|
+
if phase_with_logs.has_key?("Simulate")
|
122
|
+
simulate = phase_with_logs["Simulate"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
123
|
+
else
|
124
|
+
simulate = ""
|
125
|
+
end
|
126
|
+
if phase_with_logs.has_key?("Stage")
|
127
|
+
stage = phase_with_logs["Stage"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
128
|
+
else
|
129
|
+
stage = ""
|
130
|
+
end
|
131
|
+
if phase_with_logs.has_key?("Commit")
|
132
|
+
commit = phase_with_logs["Commit"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
|
133
|
+
else
|
134
|
+
commit = ""
|
135
|
+
end
|
136
|
+
|
137
|
+
counter += 1
|
138
|
+
table_data << [counter, server, simulate, stage, commit]
|
129
139
|
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
140
|
+
else
|
141
|
+
csv_content = CSV.parse(results_content)
|
142
|
+
|
143
|
+
logs = csv_content[6..-1] # remove the headers of the csv file
|
144
|
+
|
145
|
+
logs = logs.select { |log| !log[0].start_with?("Run at") }
|
146
|
+
|
147
|
+
logs.each do |log|
|
148
|
+
log[2] = DateTime.parse(log[2])
|
134
149
|
end
|
135
150
|
|
136
|
-
|
137
|
-
|
151
|
+
logs = logs.sort_by { |log| [log[0], log[2]] }
|
152
|
+
|
153
|
+
servers_with_logs = logs.group_by {|log| log[0] }
|
154
|
+
failed_servers_with_logs = servers_with_logs.select { |key, value| value.select{|log| log[1] == "Error" }.count > 0}
|
155
|
+
|
156
|
+
BrpmAuto.pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
157
|
+
|
158
|
+
table_data = [[' ', 'Server', 'Result', 'Error message']]
|
159
|
+
counter = 0
|
160
|
+
server_cache = ""
|
161
|
+
logs.each do |log|
|
162
|
+
if log[0] == server_cache
|
163
|
+
server = ""
|
164
|
+
else
|
165
|
+
server = log[0]
|
166
|
+
server_cache = log[0]
|
167
|
+
end
|
168
|
+
result = log[1]
|
169
|
+
message = log[3]
|
170
|
+
|
171
|
+
counter += 1
|
172
|
+
table_data << [counter, server, result, message]
|
173
|
+
end
|
138
174
|
end
|
139
175
|
|
140
176
|
BrpmAuto.pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
141
177
|
|
142
178
|
BrpmAuto.pack_response "results_link", results_full_path
|
143
179
|
|
144
|
-
raise "The
|
180
|
+
raise "The job had errors!" if had_errors
|
data/config.yml
CHANGED
data/tests/execute_job_spec.rb
CHANGED
@@ -9,26 +9,38 @@ describe 'execute job' do
|
|
9
9
|
cleanup_request_params
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'should execute
|
12
|
+
it 'should execute an NSHScriptJob to a list of servers in BladeLogic' do
|
13
13
|
params = get_default_params
|
14
14
|
params = params.merge(get_integration_params_for_bladelogic)
|
15
15
|
|
16
16
|
params["application"] = 'E-Finance'
|
17
17
|
params["job_type_and_name"] = 'NSHScriptJob|echo'
|
18
18
|
params["target_type"] = "Servers"
|
19
|
-
params["server1000_name"] = "
|
19
|
+
params["server1000_name"] = "targetserver.pulsar-it.be"
|
20
20
|
|
21
21
|
BrpmScriptExecutor.execute_automation_script("brpm_module_bladelogic", "execute_job", params)
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'should execute
|
24
|
+
it 'should execute an NSHScriptJob to a list of custom servers in BladeLogic' do
|
25
25
|
params = get_default_params
|
26
26
|
params = params.merge(get_integration_params_for_bladelogic)
|
27
27
|
|
28
28
|
params["application"] = 'E-Finance'
|
29
29
|
params["job_type_and_name"] = 'NSHScriptJob|echo'
|
30
30
|
params["target_type"] = "Servers"
|
31
|
-
params["target_path_or_servers"] = "
|
31
|
+
params["target_path_or_servers"] = "targetserver.pulsar-it.be"
|
32
|
+
|
33
|
+
BrpmScriptExecutor.execute_automation_script("brpm_module_bladelogic", "execute_job", params)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should execute a DeployJob to a list of servers in BladeLogic' do
|
37
|
+
params = get_default_params
|
38
|
+
params = params.merge(get_integration_params_for_bladelogic)
|
39
|
+
|
40
|
+
params["application"] = 'E-Finance'
|
41
|
+
params["job_type_and_name"] = "DeployJob|Deploy EF - .NET web front end 1.0.0 in development"
|
42
|
+
params["target_type"] = "Servers"
|
43
|
+
params["server1000_name"] = "targetserver.pulsar-it.be"
|
32
44
|
|
33
45
|
BrpmScriptExecutor.execute_automation_script("brpm_module_bladelogic", "execute_job", params)
|
34
46
|
end
|
data/tests/select_job_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe 'execute job' do
|
|
16
16
|
params["application"] = 'E-Finance'
|
17
17
|
|
18
18
|
result = BrpmScriptExecutor.execute_resource_automation_script("brpm_module_bladelogic", "select_job", params, nil, 0, 10)
|
19
|
-
expect(result.count).to eql(
|
19
|
+
expect(result.count).to eql(2)
|
20
20
|
|
21
21
|
result = BrpmScriptExecutor.execute_resource_automation_script("brpm_module_bladelogic", "select_job", params, "NSHScriptJob", 0, 10)
|
22
22
|
expect(result.count).to eql(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brpm_module_bladelogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niek Bartholomeus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpm_content_framework
|