linux_container 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDM4ZDdiZDVmZDI0OTAyYzVjMDBlZWMzY2ZjMzRjZTNjMjhhZTQ5MQ==
4
+ ZTJjMTU1MTEyNDM2MDNiMDU1Njg0YmZiYTE1NjI5NjQ0ODI2OGY2NA==
5
5
  data.tar.gz: !binary |-
6
- YTBjMTEwODU4YjVmMDFlOTUwNWJjMjI1Nzc2YjViM2M2MjMyOWFmOQ==
6
+ M2VmMTFlZWE3OTYwNGM5OGRhZTQ3NjgxMzM0ZmE4YTA5OWEyNTU0NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmYzZmFmODE2YjI5MmNhOWIyZDJkMTMyZTg5YTU5M2IzNTFhNTk2NWFhYzU5
10
- MWQ5NDEyOTVlZGI2MWIwZmY1Y2EwNzFmYzIwZGNhMjRkNmU2YmQxNDJiOGYz
11
- YzBjMzliZjY3Y2MzMzViNWM4M2IzMGZiNjY0YTZjNTE4Yzk4ZDk=
9
+ NGVhZGNkMTc4MWU5YTk1ZmY4NWFmMzJmNGU4NGU4YTVkYjI3NmI3YjYyYTA5
10
+ NzU2ZWFiZTY0MGFjMDM1ZTYwN2QyNzBhMzM5ZDc4Y2YxNWI5NGI5MzgzNzUw
11
+ MWFiOGI2NGNhMjM0NTdkODA3MmM4MjA5ZTViNjc5OTViOGQ0OWE=
12
12
  data.tar.gz: !binary |-
13
- YTI1MDk1OGJiODkzZjQ1NGZhM2NiNmY2N2JiZmU1MTNjNmYzMjIxMDEzYzIw
14
- NzY5YTk0ZTU4ODU3ZThmNjkyYjRlMzk2NzgzNzBlNjIxOTBiYmEyMzdiNzMx
15
- NTg0M2I0MTRmZjg0MWIxZTZkMzIwOWE5NTY5OWQxODBkOTMxN2Y=
13
+ N2M1YjQ0MTliMDk5NzJkM2FiYmUyZDVmNWVhNDQ1ODdjOWU0Njg2NDNmNjQz
14
+ NmU0YTllYTYzMmRhMjc3NTA4N2ZkYzA5NzY1NDJkODNmZWEyNDM2YzUyNzE4
15
+ Mjk1YTI0MGE0ZmZiYTQxN2FlMWY0YWQwYmYyMmM0MGI2NWVmMTE=
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v1.3. make aufs overridable for lxc 0.9+
1
2
  v1.2. make overlayfs overridable for lxc 0.8
2
3
  v1.1. scp into container support
3
4
  v1.0. state() should always return a string
@@ -46,11 +46,13 @@ class LinuxContainer
46
46
  end
47
47
 
48
48
  def start_ephemeral(config={})
49
- argshash = {'orig' => name, 'user' => username, 'union-type' => 'overlayfs'}.merge!(config)
49
+ argshash = {'orig' => name, 'user' => username}.merge!(config)
50
50
  args = []
51
51
  if self.class.version == '0.8' # ubuntu quantal and older
52
+ argshash['union-type'] ||= 'aufs'
52
53
  args.push '-U', argshash.delete('union-type')
53
54
  else # ubuntu raring and newer
55
+ argshash['union-type'] ||= 'overlayfs'
54
56
  args << '-d'
55
57
  end
56
58
  args.push *argshash.map {|k, v| "--#{k}=#{v}" }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "linux_container"
5
- s.version = "1.2"
5
+ s.version = "1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andrew Snow"]
data/test/test_all.rb CHANGED
@@ -3,10 +3,10 @@ at_exit do
3
3
  File.unlink($sshkey) rescue nil
4
4
  ($ec.destroy '-f' if $ec) rescue nil
5
5
  ($c2.destroy '-f' if $c2) rescue nil
6
- $c.destroy '-f'
6
+ $c.destroy '-f' if $c
7
7
  end
8
8
 
9
- require 'minitest/autorun'
9
+ require 'minitest/unit'
10
10
  require "#{File.dirname(__FILE__)}/../lib/linux_container"
11
11
 
12
12
  class TestLinuxContainer < MiniTest::Unit::TestCase
@@ -56,6 +56,18 @@ class TestLinuxContainer < MiniTest::Unit::TestCase
56
56
  assert($ec.wait_for { !running? }, 'wait_for !running?')
57
57
  assert($ec.wait_for { !File.exists?($ec.dir) }, 'wait_for directory deletion')
58
58
  end
59
+
60
+ def test_ephemeral_overlayfs
61
+ assert($ec = $c.start_ephemeral('union-type' => 'overlayfs'))
62
+ assert($ec.wait_for { running? }, 'wait_for running?')
63
+ assert_match /type overlayfs/, `mount`.lines.grep(/#{$ec.name}/).first
64
+ $ec.stop
65
+ assert($ec.wait_for { !running? }, 'wait_for !running?')
66
+ end
67
+
68
+
69
+
59
70
  end
60
71
 
61
72
  TestLinuxContainer.startup
73
+ MiniTest::Unit.new.run ARGV
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux_container
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Snow