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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b001996cfee5a58c8e31afa14333fc10a8d6ab41
4
- data.tar.gz: e5a68c7c98d64b00457d15e5d4e1e8d5cc1c4a6e
3
+ metadata.gz: 593c2c8a635fcb5e22cc06f021a728d9891fd820
4
+ data.tar.gz: 2913f1728d7af49d7e20a1a2d7f485c547600010
5
5
  SHA512:
6
- metadata.gz: 03ae2fd874ea77e9f14ad96a292f0b553111fbca750fbdef5d0a77f23588bf4af99a3bf46bce069a0c787fb7d7dc26d2d4fb7aec7c98906df1d8d70020228542
7
- data.tar.gz: f040be86621c1904e742d91ce695e24e1926f2c780770f40ac6ef3404856c547f16d62889ce0de686dbc3ea59a32d51a598ecad158e3b33d3fde7a58ef756935
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
- system("docker export #{@image.id} | xz -T 0 -0 > #{@image.path}")
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
- lock("create_#{@inherited.id}")
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
- puts e.backtrace
9
+ sleep sleep_duration
10
10
  ensure
11
11
  attempts += 1
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Linecook
2
- VERSION = '0.7.18'
2
+ VERSION = '0.7.19'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linecook-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.18
4
+ version: 0.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Hamel