linecook-gem 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c897a173dfc0fbfff66b44853e4d7e5fbf735fb3
4
- data.tar.gz: ad92c0dd3f835ea109f2dd2d5024133a91774e00
3
+ metadata.gz: 24bf13e1616e8352819d62a8a7456dac3c2810a9
4
+ data.tar.gz: 93ac6a5839f3bd104b6b4b6be422683cefb4647d
5
5
  SHA512:
6
- metadata.gz: 82ea68ce99f675787d7c03b0c039cf74c0cb28c3715238ccf87440e8833e9dec6c48adbd71e021012655a87f7fedad1e4d54318cd7e0f704ac43fbdc505a2371
7
- data.tar.gz: 88072bf2787e866ff4d5ac44301966796ab465c0fe471955034c22cc819e18629d809db97b27c04556d65043e3587dd232e21231e7719f2b5a713de70da4643a
6
+ metadata.gz: 3aaaf7df96d2febdb5edc58dc27034d20ff00e906dc762fe15ec27291b310e3d47002d05cc3195043b73042a747c195a8fd760fdeb1b57b6c156e445e6ade4e0
7
+ data.tar.gz: 22af8bbb43d7495428e2db2a80562b4ca18549a9ae993ad3fa40b13bb5111e3e80a8b983473b54084f55a60f07913c461807b6732b2bda84eee7af0464e670e1
@@ -25,11 +25,11 @@ module Linecook
25
25
  @ssh ||= Linecook::SSH.new(@container.ip, username: USERNAME, proxy: Linecook::Builder.ssh, keyfile: Linecook::SSH.private_key, setup: false)
26
26
  end
27
27
 
28
- def snapshot(save: false)
28
+ def snapshot(save: false, resume: false)
29
29
  path = "/tmp/#{@id}-#{Time.now.to_i}.squashfs"
30
30
  @container.pause
31
31
  Linecook::Builder.ssh.run("sudo mksquashfs #{@container.root} #{path} -wildcards -e 'usr/src' 'var/lib/apt/lists/archive*' 'var/cache/apt/archives'") # FIXME make these excludes dynamic based on OS
32
- @container.resume
32
+ @container.resume if resume
33
33
  path = if save
34
34
  local_path = File.join(Linecook::ImageManager::IMAGE_PATH, File.basename(path))
35
35
  Linecook::Builder.ssh.download(path, local: local_path)
data/lib/linecook/cli.rb CHANGED
@@ -114,6 +114,7 @@ class Build < Thor
114
114
 
115
115
  desc 'snapshot', 'Take a snapshot of the build with NAME'
116
116
  method_option :name, type: :string, required: true, banner: 'ROLE_NAME', desc: 'Name of the role to build', aliases: '-n'
117
+ method_option :resume, type: :boolean, default: false, desc: 'Resume the build after snapshotting it', aliases: '-r'
117
118
  def snapshot
118
119
  build = Linecook::Build.new(name, '')
119
120
  build.snapshot(save: true)
@@ -12,7 +12,7 @@ module Linecook
12
12
  def bake(name: nil, tag: nil, id: nil, snapshot: nil, upload: nil, package: nil, build: nil, keep: nil, clean: nil)
13
13
  build_agent = Linecook::Build.new(name, tag: tag, id: id, image: image(name))
14
14
  provider(name).provision(build_agent, name) if build
15
- snapshot = build_agent.snapshot(save: true) if snapshot || upload || package
15
+ snapshot = build_agent.snapshot(save: true, resume: true unless clean) if snapshot || upload || package
16
16
  Linecook::ImageManager.upload(snapshot, type: build_agent.type) if upload || package
17
17
  Linecook::Packager.package(snapshot, type: build_agent.type) if package
18
18
  rescue => e
@@ -88,7 +88,7 @@ module Linecook
88
88
 
89
89
  def forward(local, remote:nil)
90
90
  remote ||= local
91
- opts = { password: @password }
91
+ opts = { password: @password, paranoid: Net::SSH::Verifiers::Null.new }
92
92
  opts.merge!({ proxy: @proxy }) if @proxy
93
93
  @session = Net::SSH.start(@hostname, @username, opts)
94
94
  @session.forward.remote(local, '127.0.0.1', remote)
@@ -1,3 +1,3 @@
1
1
  module Linecook
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Hamel