linux_container 1.3 → 1.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTJjMTU1MTEyNDM2MDNiMDU1Njg0YmZiYTE1NjI5NjQ0ODI2OGY2NA==
4
+ Mjc1ZDc1MDMyZTBhNDJhZDNmMGRlZTgzZjIzZjNiMzEyZDlhMzUyZg==
5
5
  data.tar.gz: !binary |-
6
- M2VmMTFlZWE3OTYwNGM5OGRhZTQ3NjgxMzM0ZmE4YTA5OWEyNTU0NA==
6
+ NzU1MDUyMjQyYzk2OWE5NTg4ZmRmOGEzYzRhNjVjMTAxNzBjZjYwNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NGVhZGNkMTc4MWU5YTk1ZmY4NWFmMzJmNGU4NGU4YTVkYjI3NmI3YjYyYTA5
10
- NzU2ZWFiZTY0MGFjMDM1ZTYwN2QyNzBhMzM5ZDc4Y2YxNWI5NGI5MzgzNzUw
11
- MWFiOGI2NGNhMjM0NTdkODA3MmM4MjA5ZTViNjc5OTViOGQ0OWE=
9
+ MWVmMmQxMzhkZTQ1MjI2MGQ2ZjEyOGM0OTZjZWZhNGQ2ZTcyNzAzNzM4YjA2
10
+ NDM2YTcwZDc5ZjAyYWQ5YjcyZDgyODk2Y2ViZDI1MzVjMjVkNDcwNjZiMzdm
11
+ NWY4N2U0OTIxYWMwYTQyMjk1ZGMwZjA2NDk1NWM3YzUyZDg2NjY=
12
12
  data.tar.gz: !binary |-
13
- N2M1YjQ0MTliMDk5NzJkM2FiYmUyZDVmNWVhNDQ1ODdjOWU0Njg2NDNmNjQz
14
- NmU0YTllYTYzMmRhMjc3NTA4N2ZkYzA5NzY1NDJkODNmZWEyNDM2YzUyNzE4
15
- Mjk1YTI0MGE0ZmZiYTQxN2FlMWY0YWQwYmYyMmM0MGI2NWVmMTE=
13
+ MjJiM2EyZTAwZjVkYjY1Yjc0Njk2NjQ1NTdlNTVlNzBhMDYxMzIzM2QyMjJi
14
+ M2U5MjQyMjk0ZGI3ODRmMGJlMTc3Y2Q3NDQyNzc5MWE3OTQ5MWNiY2FhMjkx
15
+ YzYwNTI5ZDBmMjM1ZmNhMjJkYjE5OWZjZDA0NTJmZjJkNGUxNjI=
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v1.4. parent_container feature
1
2
  v1.3. make aufs overridable for lxc 0.9+
2
3
  v1.2. make overlayfs overridable for lxc 0.8
3
4
  v1.1. scp into container support
data/README.md CHANGED
@@ -43,6 +43,8 @@ very little disk space, which then disappears when shut down.
43
43
 
44
44
  > e = c.start_ephemeral
45
45
  > e.wait_for { ip && sshable? }
46
+ > e.parent_container
47
+ => #<LinuxContainer:...>
46
48
 
47
49
 
48
50
  ### Clone an existing container and start it in background, with 512M memlimit
@@ -62,7 +64,7 @@ very little disk space, which then disappears when shut down.
62
64
  > c.shutdown '-t', '120'
63
65
 
64
66
 
65
- ### Force shutdown
67
+ ### Force shutdown & delete
66
68
 
67
69
  > c.destroy '-f'
68
70
 
@@ -44,6 +44,11 @@ class LinuxContainer
44
44
  fromname = self.class === from ? from.name : from
45
45
  lxc_execute('clone', '-o',fromname, *args)
46
46
  end
47
+
48
+ def parent_container
49
+ n = name.dup
50
+ self.class.new(name: n) if n.sub!(/-temp-[0-9A-Za-z]+$/, '')
51
+ end
47
52
 
48
53
  def start_ephemeral(config={})
49
54
  argshash = {'orig' => name, 'user' => username}.merge!(config)
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "linux_container"
5
- s.version = "1.3"
5
+ s.version = "1.4"
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"]
9
- s.date = "2013-04-10"
9
+ s.date = "2013-04-24"
10
10
  s.description = "Ruby gem for ephemeral LXC linux containers"
11
11
  s.email = "andrew@modulus.org"
12
12
  s.extra_rdoc_files = ["CHANGELOG", "README.md", "lib/linux_container.rb"]
data/test/test_all.rb CHANGED
@@ -44,7 +44,8 @@ class TestLinuxContainer < MiniTest::Unit::TestCase
44
44
 
45
45
  def test_ephemeral
46
46
  assert($ec = $c.start_ephemeral)
47
- assert_match /^linuxcontainergemtest.+/, $ec.name
47
+ assert_match /^linuxcontainergemtest-temp-[a-zA-Z0-9]+$/, $ec.name
48
+ assert_equal $c.name, $ec.parent_container.name
48
49
  assert($ec.wait_for { running? }, 'wait_for running?')
49
50
  assert($ec.wait_for { ip }, 'wait_for ip')
50
51
  assert($ec.wait_for { sshable? }, 'wait_for sshable?')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux_container
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Snow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-10 00:00:00.000000000 Z
11
+ date: 2013-04-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby gem for ephemeral LXC linux containers
14
14
  email: andrew@modulus.org