linecook-gem 0.7.18 → 0.7.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 +4 -4
- data/lib/linecook-gem/baker/docker.rb +17 -12
- data/lib/linecook-gem/util/common.rb +2 -2
- data/lib/linecook-gem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 593c2c8a635fcb5e22cc06f021a728d9891fd820
|
4
|
+
data.tar.gz: 2913f1728d7af49d7e20a1a2d7f485c547600010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3dc84325463e36c291cd4f93b2bab8ddfc4b120e907ffa23f8a4b74321be24d992b0e7977ef64589465ae066eb028102f60a257eb83b31f8bd779b6e824a72
|
7
|
+
data.tar.gz: 360ec87a4328866503c303e3a65cd6860b8b7f969d71f2863bb8382b9395d1d49a69990f8810238d4545f11cee6d7e9b784b9859f93b9d427ef03c66490350ad
|
@@ -27,7 +27,10 @@ module Linecook
|
|
27
27
|
def save
|
28
28
|
FileUtils.mkdir_p(File.dirname(@image.path))
|
29
29
|
container.stop
|
30
|
-
|
30
|
+
with_retries(5) do
|
31
|
+
status = system("docker export #{@image.id} | xz -T 0 -0 > #{@image.path}")
|
32
|
+
fail "Export failed" unless status
|
33
|
+
end
|
31
34
|
end
|
32
35
|
|
33
36
|
def instance
|
@@ -36,13 +39,15 @@ module Linecook
|
|
36
39
|
|
37
40
|
def converge
|
38
41
|
if @inherited
|
39
|
-
|
40
|
-
|
41
|
-
with_retries(3) do
|
42
|
+
begin
|
42
43
|
instance.create
|
44
|
+
rescue
|
45
|
+
# Disable the cache and retry if we ran into a problem
|
46
|
+
@data[:driver][:use_cache] = false
|
47
|
+
with_retries(5) do
|
48
|
+
instance.create
|
49
|
+
end
|
43
50
|
end
|
44
|
-
|
45
|
-
unlock("create_#{@inherited.id}")
|
46
51
|
end
|
47
52
|
instance.converge
|
48
53
|
ensure
|
@@ -98,15 +103,15 @@ module Linecook
|
|
98
103
|
|
99
104
|
# May the gods forgive us for all the rules this breaks
|
100
105
|
def munge_config
|
101
|
-
data = @config.send(:data).instance_variable_get(:@data)
|
102
|
-
data[:driver][:instance_name] = @image.id
|
103
|
-
suite = data[:suites].find{ |n| n[:name] == @image.name }
|
106
|
+
@data = @config.send(:data).instance_variable_get(:@data)
|
107
|
+
@data[:driver][:instance_name] = @image.id
|
108
|
+
suite = @data[:suites].find{ |n| n[:name] == @image.name }
|
104
109
|
if suite && suite[:inherit]
|
105
110
|
inherited = Linecook::Image.new(suite[:inherit][:name], suite[:inherit][:group], suite[:inherit][:tag])
|
106
111
|
inherit(inherited)
|
107
|
-
data[:driver][:image] = "#{inherited.group}:#{inherited.tag}"
|
108
|
-
data[:driver][:provision_command] ||= []
|
109
|
-
data[:driver][:provision_command] << 'sed -i \'s/\(PasswordAuthentication no\)/#\1/g\' /etc/ssh/sshd_config'
|
112
|
+
@data[:driver][:image] = "#{inherited.group}:#{inherited.tag}"
|
113
|
+
@data[:driver][:provision_command] ||= []
|
114
|
+
@data[:driver][:provision_command] << 'sed -i \'s/\(PasswordAuthentication no\)/#\1/g\' /etc/ssh/sshd_config'
|
110
115
|
end
|
111
116
|
end
|
112
117
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
def with_retries(retries, &block)
|
1
|
+
def with_retries(retries, sleep_duration: 5, &block)
|
2
2
|
attempts = 0
|
3
3
|
while attempts < retries
|
4
4
|
begin
|
@@ -6,7 +6,7 @@ def with_retries(retries, &block)
|
|
6
6
|
rescue => e
|
7
7
|
puts "Retrying a failed action, error was:"
|
8
8
|
puts e.message
|
9
|
-
|
9
|
+
sleep sleep_duration
|
10
10
|
ensure
|
11
11
|
attempts += 1
|
12
12
|
end
|
data/lib/linecook-gem/version.rb
CHANGED