scout_agent 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/lib/scout_agent.rb +1 -1
- data/lib/scout_agent/agent/master_agent.rb +7 -7
- data/lib/scout_agent/assignment/snapshot.rb +10 -5
- data/lib/scout_agent/database.rb +9 -1
- data/lib/scout_agent/id_card.rb +1 -1
- data/lib/scout_agent/mission.rb +5 -5
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 3.1.3
|
2
|
+
|
3
|
+
* Modified file modes to match lock types to get the file locking code running
|
4
|
+
on Solaris
|
5
|
+
* Fixed a variable name conflict
|
6
|
+
* Cleaned up some of the mission error catching code
|
7
|
+
|
1
8
|
== 3.1.2
|
2
9
|
|
3
10
|
* Fixed a bug that caused the mission tester to error out when trying to update
|
data/lib/scout_agent.rb
CHANGED
@@ -91,7 +91,7 @@ module ScoutAgent
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# The version of this agent.
|
94
|
-
VERSION = "3.1.
|
94
|
+
VERSION = "3.1.3".freeze
|
95
95
|
# A Pathname reference to the agent code directory, used in dynamic loading.
|
96
96
|
LIB_DIR = Pathname.new(File.dirname(__FILE__)) + agent_name
|
97
97
|
end
|
@@ -192,15 +192,15 @@ module ScoutAgent
|
|
192
192
|
)
|
193
193
|
end
|
194
194
|
rescue Timeout::Error # Mission exceeded allowed execution
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
killed_status = Process.term_or_kill(@mission_pid)
|
196
|
+
status_str = killed_status && killed_status.exitstatus
|
197
|
+
@mission_pid = nil
|
198
|
+
log.error("#{mission[:name]} took too long to run: #{status_str}.")
|
199
199
|
@db.write_report(
|
200
200
|
mission[:id],
|
201
201
|
:error,
|
202
202
|
:subject => "#{mission[:name]} took too long to run",
|
203
|
-
:body => "Exit status: #{
|
203
|
+
:body => "Exit status: #{status_str}"
|
204
204
|
)
|
205
205
|
end
|
206
206
|
# prevent an infinite loop if we can't complete the mission
|
@@ -363,8 +363,8 @@ module ScoutAgent
|
|
363
363
|
status("Compiling")
|
364
364
|
begin
|
365
365
|
eval(mission[:code], TOPLEVEL_BINDING, mission[:name])
|
366
|
-
rescue Exception => error
|
367
|
-
raise if
|
366
|
+
rescue Exception => error # any compile error
|
367
|
+
raise if error.is_a? SystemExit # don't catch exit() calls
|
368
368
|
log.error( "#{mission[:name]} could not be compiled: " +
|
369
369
|
"#{error.message} (#{error.class})." )
|
370
370
|
reported = @db.write_report(
|
@@ -31,11 +31,16 @@ module ScoutAgent
|
|
31
31
|
end
|
32
32
|
|
33
33
|
#
|
34
|
-
# lock on
|
35
|
-
# time
|
34
|
+
# lock on an external lock file to ensure only one process can run a
|
35
|
+
# snapshot at a time
|
36
36
|
#
|
37
|
-
open(
|
38
|
-
|
37
|
+
(Plan.db_dir + "snapshot_in_progress.lock").open("a") do |lock|
|
38
|
+
begin
|
39
|
+
lock.chmod(0777) # make sure this file is shared by all
|
40
|
+
rescue Exception # we didn't create the file
|
41
|
+
# do nothing: the creator already switched the permissions
|
42
|
+
end
|
43
|
+
unless lock.flock(File::LOCK_EX | File::LOCK_NB)
|
39
44
|
exit # snapshot in progress
|
40
45
|
end
|
41
46
|
|
@@ -115,7 +120,7 @@ module ScoutAgent
|
|
115
120
|
ScoutAgent.remove_old_log_files(log)
|
116
121
|
|
117
122
|
log.info("Snapshot complete.")
|
118
|
-
|
123
|
+
lock.flock(File::LOCK_UN) # release our snapshot lock
|
119
124
|
end
|
120
125
|
end
|
121
126
|
|
data/lib/scout_agent/database.rb
CHANGED
@@ -150,7 +150,12 @@ module ScoutAgent
|
|
150
150
|
# external locking mechanism on the database code file to prevent doubled
|
151
151
|
# +VACUUM+ race conditions.
|
152
152
|
#
|
153
|
-
(
|
153
|
+
Pathname.new(path.to_s.sub(/\.sqlite\z/, ".lock")).open("a") do |db|
|
154
|
+
begin
|
155
|
+
db.chmod(0777) # make sure this file is shared by all
|
156
|
+
rescue Exception # we didn't create the file
|
157
|
+
# do nothing: the creator already switched the permissions
|
158
|
+
end
|
154
159
|
db.flock(File::LOCK_EX)
|
155
160
|
begin
|
156
161
|
if @sqlite.first_value_from(
|
@@ -174,6 +179,9 @@ module ScoutAgent
|
|
174
179
|
rescue Amalgalite::SQLite3::Error => error # failed to +VACUUM+ database
|
175
180
|
log.error("Database maintenance error: #{error.message}.")
|
176
181
|
nil # maintenance failed, we will try again later
|
182
|
+
# rescue Exception => error # file locking error
|
183
|
+
# log.error("Database maintenance locking error: #{error.message}.")
|
184
|
+
# nil # maintenance failed, we will try again later
|
177
185
|
end
|
178
186
|
|
179
187
|
# Returns +true+ if this connection is currently read locked.
|
data/lib/scout_agent/id_card.rb
CHANGED
data/lib/scout_agent/mission.rb
CHANGED
@@ -294,15 +294,15 @@ module ScoutAgent
|
|
294
294
|
if self.class.needs.all? { |l| library_available?(l) }
|
295
295
|
begin
|
296
296
|
build_report
|
297
|
-
rescue Exception
|
298
|
-
raise if
|
297
|
+
rescue Exception => error # an error while running the code
|
298
|
+
raise if error.is_a? SystemExit # don't catch exit() calls
|
299
299
|
error "#{@name} run failed with an error", <<-END_ERROR.trim
|
300
300
|
Error:
|
301
|
-
#{
|
301
|
+
#{error.class}
|
302
302
|
Message:
|
303
|
-
#{
|
303
|
+
#{error.message}
|
304
304
|
Backtrace:
|
305
|
-
#{
|
305
|
+
#{error.backtrace.map { |line| " #{line}\n" }.join}
|
306
306
|
END_ERROR
|
307
307
|
end
|
308
308
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-05-
|
15
|
+
date: 2009-05-05 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
requirements: []
|
183
183
|
|
184
184
|
rubyforge_project: scout
|
185
|
-
rubygems_version: 1.3.
|
185
|
+
rubygems_version: 1.3.3
|
186
186
|
signing_key:
|
187
187
|
specification_version: 3
|
188
188
|
summary: Scout makes monitoring and reporting on your servers as flexible and simple as possible.
|