mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
im-collectd: Add mutex to the sync command
This commit is contained in:
parent
0efc81f0ef
commit
9146b2ef35
@ -189,12 +189,19 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
host_errors = Array.new
|
||||
lock = Mutex.new
|
||||
|
||||
ts = hs_threads.map do |t|
|
||||
Thread.new {
|
||||
t.each do |host|
|
||||
sync_cmd = "scp -rp #{REMOTES_LOCATION}/. #{host}:#{remote_dir} 2> /dev/null"
|
||||
`#{sync_cmd} 2>/dev/null`
|
||||
host_errors << host if !$?.success?
|
||||
|
||||
if !$?.success?
|
||||
lock.synchronize {
|
||||
host_errors << host
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user