omf_rc_shm 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGFmMDYyMWEyZGU3ZmQ4NzRiYjFjYzBhOTdkNTRmMjQ3YWEwYjZjOQ==
4
+ ZjRiMjIzZmRmNGJmNzA1MmNjN2I2NDEzZGQ0YzliMDI3YmFjMzE1Yw==
5
5
  data.tar.gz: !binary |-
6
- M2Y1ZTBmMzNkMmE5NmRiMzY4Y2VmNTZkYzNkMGEzNzBlNWFlMjBiOQ==
6
+ YzI5YTViNmI2OGUyODBmNDIxNjc2YmI3NDllY2M5NmVkMzBhNjE3Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWZmYTAwMjE4M2U3NjEzM2EwN2YyYTQ3ZDEyNGUwZDY2MTJhNmZmNzVkYTNj
10
- NGJhYWE2MGVlOTljZTY4YzFlNzBmNmE3ZDBjY2NkYWZmNDdjYWUyY2NjM2Rh
11
- MTY0ZDkzNjY1NjUzMGM5NmNiNTc3NGQ4NjBiOWM5NTA5M2VmNDE=
9
+ MWQ3MzdiZGVmNTA4YjBjMDQwYjQ4YjM5MDAzMDFkZGZjZGY1YTM4ZWEzZTBi
10
+ NDRkYzAwOTUxNjJhMTViMjhjNWRkNWFlMTVjMzBkNWU2ZDA2NmU0OTFhNzll
11
+ YThmMTQ2OWRiY2Y3YTExNDA1NGViMWFlODRmMmIwODU1MmIzNjY=
12
12
  data.tar.gz: !binary |-
13
- NmU1NDdhOGU2MTAyM2YwODkxMTEzYmE4MjYyYzQ4ZjAyNDY5MDFjMTYwZjY0
14
- ODZkZWUxMjJjYjBhNzRlNTgwOGQ4ZTk1OWUyNDNiOTI5MzdiNDU5MTJmNGI0
15
- MzgxNDA1ZTRiMDI1Yzc2ODJjNDI2ZDIyMDg3YTczZGQxYzUyYmE=
13
+ NGE4YTZhMmMxYzk0MDE5MjEzM2RiOTg4YWQ2ZTk2MjQ0Y2NiN2QyODg1ZTdk
14
+ OTZiYzUyNmY5Njk5NGIzOTBiMDUzZGQ4ODBmYmM0NDRjZDM3MTViYmU3OTc4
15
+ YWFiMzUxODY5NmIyOTVjZWVhYjk3YWRmMjYzMDhmOTc0ZTY3MDI=
@@ -23,28 +23,28 @@ module OmfRc::ResourceProxy::ShmNode
23
23
  unless node.property.time_sync_tries.nil?
24
24
  require 'net/ntp'
25
25
  info "Option 'time_sync_tries' is set. Continue only if local time is accurate, will try to sync #{node.property.time_sync_tries} times with random wait of up to #{node.property.time_sync_interval}s."
26
- (1..node.property.time_sync_tries.to_i).each do |i|
27
- dt = node.property.time_sync_maxdrift.to_i
28
- lt = 0
29
- rt = 0
26
+ dt = node.property.time_sync_maxdrift.to_i + 1
27
+ lt = rt = t = 0
28
+ while dt >node.property.time_sync_maxdrift.to_i do
29
+ t = t+1
30
30
  begin
31
31
  lt = Time.now ; rt = Net::NTP.get.time ; dt = (lt-rt).abs
32
- rescue Exception => e
32
+ if dt > node.property.time_sync_maxdrift.to_i
33
+ info "Time sync try #{t} - Local: #{lt.to_i} - NTP: #{rt.to_i} - Diff: #{dt} - (sync: #{node.property.time_sync_cmd.to_s})"
34
+ res = `#{node.property.time_sync_cmd.to_s}`
35
+ sleep(rand(node.property.time_sync_interval.to_i))
36
+ else
37
+ break
38
+ end
39
+ rescue Exception => e
33
40
  info "Time sync try #{i} - Cannot contact NTP server (#{e})"
41
+ sleep(rand(node.property.time_sync_interval.to_i))
34
42
  end
35
- if dt > node.property.time_sync_maxdrift.to_i
36
- info "Time sync try #{i} - Local: #{lt.to_i} - NTP: #{rt.to_i} - Diff: #{dt} - (sync: #{node.property.time_sync_cmd.to_s})"
37
- res = `#{node.property.time_sync_cmd.to_s}`
38
- else
39
- break
40
- end
41
- sleep(rand(node.property.time_sync_interval.to_i))
42
- end
43
- lt = Time.now ; rt = Net::NTP.get.time ; dt = (lt-rt).abs
44
- if dt > node.property.time_sync_maxdrift.to_i
45
- info "Time sync FAILED! EXITING NOW!"
46
- exit
47
- end
43
+ if t > node.property.time_sync_tries.to_i
44
+ info "Time sync FAILED! EXITING NOW!"
45
+ exit
46
+ end
47
+ end
48
48
  info "Time sync OK - Local: #{lt.to_i} - NTP: #{rt.to_i} - Diff: #{dt}"
49
49
  end
50
50
  # 2) if present, load and set default app schedule
@@ -1,3 +1,3 @@
1
1
  module OmfRcShm
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_rc_shm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - NICTA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-01 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler