linecook-gem 0.6.8 → 0.6.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7548b07e15bc2a9a01fa16dbf1d9ad6929293602
|
4
|
+
data.tar.gz: ff6d6af3f5dee670c3b27dd5eced9b6c48d236e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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: {
|
data/lib/linecook-gem/version.rb
CHANGED