xp5k 0.0.18 → 0.0.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 031feb0e6c261fbe46c2bf08f5e3c36961ff4d23
4
- data.tar.gz: 4eb52d5d2606387f344b74481614eed33cdf3e76
3
+ metadata.gz: '0821a928a8e43b38bff1413c8bd7015075a2185e'
4
+ data.tar.gz: 35f842381e74abcc6267d384b8cc119656e42d6d
5
5
  SHA512:
6
- metadata.gz: 0f8a668ba3d19f349534c49e83caac2ed37af134a7a6254f9065ef1360b9b4321cd0598eac40d9b16972fd7c1b2050d7c848f48aed35dd9c6049e8e303458c4a
7
- data.tar.gz: 8746b87af5a20cc557c400901880069e3e5f87eafa214701fef722730703b388f8768eaef19b5b5df3f5b67b204c17f5e38eb9ec271b76ed72eddc15015fe6ec
6
+ metadata.gz: 1a9f924f1db0f797afa5c28f70544033a59a0c79c32541471b63bd8992cf73e588b9a57fcb33e3704ab902c08587637d9962afd686bcdfb82484b17086c2be20
7
+ data.tar.gz: 167129ceb3f99a09348c5a8f5df3943e6e925cc2fee5fe941e69610fb22bfb5e6aba2f1db1ff724692018e8b394637d9edb41a59dc956c633ab633802809c26c
data/lib/xp5k/rake/dsl.rb CHANGED
@@ -68,7 +68,11 @@ module XP5K
68
68
  cmd_env = options[:environment].map do |key, value|
69
69
  "#{key}=#{value}"
70
70
  end
71
-
71
+
72
+ options[:retry] ||= ( XP5K::Config[:onRetry] ||= false )
73
+ options[:retryCount] ||= ( XP5K::Config[:onRetryCount] ||= 3 )
74
+ options[:retryDelay] ||= ( XP5K::Config[:onRetryDelay] ||= 3 )
75
+
72
76
  # net/ssh specific options
73
77
  options[:ssh] ||= {}
74
78
 
@@ -83,6 +87,8 @@ module XP5K
83
87
  end
84
88
  end
85
89
 
90
+ retryCount = XP5K::Config[:onRetryCount]
91
+
86
92
  until all_connected
87
93
  failed = false
88
94
  gateway_options = {}
@@ -96,15 +102,23 @@ module XP5K
96
102
  begin
97
103
  while host = workq.pop(true)
98
104
  begin
99
- timeout(5) do
105
+ Timeout.timeout(5) do
100
106
  ssh_session[host] = gateway.ssh(host, options[:user], options[:ssh])
101
107
  puts "Connected to #{host}..."
102
108
  end
103
109
  rescue Timeout::Error, Net::SSH::Disconnect, Exception => e
104
- puts "Removing #{host} (#{e.message})..."
105
- hosts.delete host
106
- failed_servers << host
107
- failed = true
110
+ if not options[:retry]
111
+ puts "Removing #{host} (#{e.message})..."
112
+ hosts.delete host
113
+ failed_servers << host
114
+ elsif retryCount > 0
115
+ puts "Error connecting to #{host}. Retry in #{options[:retryDelay]}s (#{retryCount} attempts)."
116
+ retryCount -= 1
117
+ sleep options[:retryDelay]
118
+ else
119
+ raise "Error connecting to #{host} after #{options[:retryCount]} attempts."
120
+ end
121
+ failed = true
108
122
  end
109
123
  end
110
124
 
data/lib/xp5k/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module XP5K
2
- VERSION='0.0.18'
2
+ VERSION='0.0.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xp5k
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Morillon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-09 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: 1.3.6
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.6.14
155
+ rubygems_version: 2.5.2.3
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: A small Grid'5000 helper