linecook-gem 0.6.8 → 0.6.9

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: fd349482e39e136417611db9075534899f42db24
4
- data.tar.gz: 0539cc47ba2b5ae11dd788da9874cbd12d24c709
3
+ metadata.gz: 7548b07e15bc2a9a01fa16dbf1d9ad6929293602
4
+ data.tar.gz: ff6d6af3f5dee670c3b27dd5eced9b6c48d236e4
5
5
  SHA512:
6
- metadata.gz: 2b1e85cb294cc635b51e10657ed075f0d898328ee4ef8762d0f438eb48c96be41727b5a16bf82ffa36ac2ea5e7b9b1f7ccd00ce44cd18451135c10020f71945d
7
- data.tar.gz: 628b06990be9c159b1745f7711b870d81c6b08391af729dc3603b7c6c1ed56bf548c878766b47aa8a3f6d6f47f50706c6eea9825775c40c7738accff95e5fa73
6
+ metadata.gz: 4eceda73724113932ba5fbc76922324760cc64fbd19ebb512ef96269e87a061cb3d8bf11ba8a7fda5cada581d268a9aa04ebc33ed7a49c48f3408f5ae8a3c3b7
7
+ data.tar.gz: 575d0682c6e9e1c7b3a42aa18b3ca541c71d342dd37a002f4815a1eed39051f2d8f86e4f20d792b1bb681cad6fddb6bc0ddac7ec1e0ffcae817c93536f2a2dc2
@@ -15,7 +15,7 @@ module Linecook
15
15
  @id = id ? "#{@type}-#{id}" : @type
16
16
  @id = @id.gsub(/[\/|\.]/,'_')
17
17
  @image = image || Linecook.config[:provisioner][:default_image]
18
- @container = Linecook::Lxc::Container.new(name: @id, image: @image, remote: Linecook::Builder.ssh)
18
+ @container = Linecook::Lxc::Container.new(name: @id, image: @image, remote: Linecook::Builder.ssh, tmp: Linecook.config[:tmp])
19
19
  end
20
20
 
21
21
  def clean
@@ -5,7 +5,7 @@ module Linecook
5
5
  def backend
6
6
  config = Linecook.config[:builder]
7
7
  images = Linecook.config[:image][:images]
8
- Linecook::Lxc::Container.new(name: config[:name], home: config[:home], image: config[:image], bridge: true)
8
+ Linecook::Lxc::Container.new(name: config[:name], home: config[:home], image: config[:image], bridge: true, tmp: Linecook.config[:tmp])
9
9
  end
10
10
  end
11
11
  end
@@ -12,13 +12,17 @@ module Linecook
12
12
  include Executor
13
13
  MAX_WAIT = 60
14
14
  attr_reader :config, :root
15
- def initialize(name: 'linecook', home: '/u/lxc', image: nil, remote: :local, bridge: false)
15
+ def initialize(name: 'linecook', home: '/u/lxc', image: nil, remote: :local, bridge: false, tmp: nil)
16
16
  @name = name
17
17
  @home = home
18
18
  @bridge = bridge
19
19
  @remote = remote == :local ? false : remote
20
20
  @root = File.join(@home, @name, 'rootfs')
21
- config = { utsname: name, rootfs: @root }
21
+ @tmp = tmp
22
+ @tmpmount = "linecook_#{name}"
23
+ config = { utsname: name, rootfs: @root, }
24
+ config.merge!(mount: {entry: "#{capture("mktemp -d --tmpdir=/#{@tmp} #{@tmpmount}XXXXXXX").strip} #{@tmp} none bind,create=dir 0 0"}) if @tmp
25
+
22
26
  @config = Linecook::Lxc::Config.generate(config) # FIXME read link from config
23
27
  @source_image = image || :base_image
24
28
  end
@@ -165,6 +169,7 @@ module Linecook
165
169
  execute("umount #{@lower_dir}")
166
170
  execute("rmdir #{@lower_dir}")
167
171
  execute("rmdir #{@upper_base}")
172
+ execute("rm -rf /#{@tmp}/#{@tmpmount}*") if @tmp && !@tmp.empty? && @tmp != '/'
168
173
 
169
174
  # Clean up the source image, but only if it's not mounted elsewhre
170
175
  FileUtils.rm_f(source) if clean && capture("mount | grep #{source} || true").strip.empty?
@@ -237,7 +242,7 @@ eos
237
242
  link: 'lxcbr0'
238
243
  },
239
244
  mount: {
240
- auto: 'cgroup'
245
+ auto: 'cgroup',
241
246
  },
242
247
  cgroup: {
243
248
  devices: {
@@ -1,3 +1,3 @@
1
1
  module Linecook
2
- VERSION = '0.6.8'
2
+ VERSION = '0.6.9'
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.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Hamel