linux_container 0.5 → 0.6
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.
- data/CHANGELOG +1 -0
- data/lib/linux_container.rb +5 -6
- data/linux_container.gemspec +12 -3
- data/test/test_all.rb +1 -0
- metadata +7 -5
- checksums.yaml +0 -15
data/CHANGELOG
CHANGED
data/lib/linux_container.rb
CHANGED
@@ -40,12 +40,11 @@ class LinuxContainer
|
|
40
40
|
|
41
41
|
def start_ephemeral
|
42
42
|
args = ['lxc-start-ephemeral','-U','aufs','-u',username,'-o',name]
|
43
|
-
|
43
|
+
logfile_path = bg_execute(*args)
|
44
44
|
newname = nil
|
45
45
|
while newname.nil?
|
46
46
|
sleep 1
|
47
|
-
|
48
|
-
newname = $1 if logfile.read =~ /^(.*) is running/
|
47
|
+
newname = $1 if File.read(logfile_path) =~ /^(.*) is running/
|
49
48
|
end
|
50
49
|
self.class.new(name: newname, ssh_key_path: ssh_key_path, username: username)
|
51
50
|
end
|
@@ -100,11 +99,11 @@ class LinuxContainer
|
|
100
99
|
end
|
101
100
|
|
102
101
|
def bg_execute(*cmd)
|
103
|
-
|
104
|
-
cmdstring = "( #{self.class.sudo_if_needed} #{cmd.shift} #{Shellwords.join(cmd)} >>#{
|
102
|
+
logfile_path = "/tmp/lxc_ephemeral_#{Time.now.to_i.to_s(36)}#{$$}#{rand(0x100000000).to_s(36)}.log"
|
103
|
+
cmdstring = "( #{self.class.sudo_if_needed} #{cmd.shift} #{Shellwords.join(cmd)} >>#{logfile_path} 2>>#{logfile_path} & )"
|
105
104
|
system(cmdstring)
|
106
105
|
raise "command failed: #{cmdstring.inspect}\n" unless $? == 0
|
107
|
-
|
106
|
+
logfile_path
|
108
107
|
end
|
109
108
|
|
110
109
|
def self.get_ip_for(name)
|
data/linux_container.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "linux_container"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.6"
|
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-03-
|
9
|
+
s.date = "2013-03-13"
|
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"]
|
@@ -15,7 +15,16 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Linux_container", "--main", "README.md"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "linux_container"
|
18
|
-
s.rubygems_version = "
|
18
|
+
s.rubygems_version = "1.8.24"
|
19
19
|
s.summary = "Ruby gem for ephemeral LXC linux containers"
|
20
20
|
s.test_files = ["test/test_all.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
21
30
|
end
|
data/test/test_all.rb
CHANGED
@@ -51,6 +51,7 @@ class TestLinuxContainer < MiniTest::Unit::TestCase
|
|
51
51
|
assert_equal "hi\n", $ec.execute('echo hi')
|
52
52
|
$ec.stop
|
53
53
|
assert($ec.wait_for { !running? }, 'wait_for !running?')
|
54
|
+
assert($ec.wait_for { File.exists?($ec.dir) }, 'wait_for directory deletion')
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linux_container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: '0.6'
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Andrew Snow
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: Ruby gem for ephemeral LXC linux containers
|
14
15
|
email: andrew@modulus.org
|
@@ -28,7 +29,6 @@ files:
|
|
28
29
|
- linux_container.gemspec
|
29
30
|
homepage: https://github.com/andys/linux_container
|
30
31
|
licenses: []
|
31
|
-
metadata: {}
|
32
32
|
post_install_message:
|
33
33
|
rdoc_options:
|
34
34
|
- --line-numbers
|
@@ -44,16 +44,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
none: false
|
47
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
49
|
requirements:
|
49
50
|
- - ! '>='
|
50
51
|
- !ruby/object:Gem::Version
|
51
52
|
version: '1.2'
|
53
|
+
none: false
|
52
54
|
requirements: []
|
53
55
|
rubyforge_project: linux_container
|
54
|
-
rubygems_version:
|
56
|
+
rubygems_version: 1.8.24
|
55
57
|
signing_key:
|
56
|
-
specification_version:
|
58
|
+
specification_version: 3
|
57
59
|
summary: Ruby gem for ephemeral LXC linux containers
|
58
60
|
test_files:
|
59
61
|
- test/test_all.rb
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
Yzg0MmQwMTFkNTI5NTZjZWEyYmEwYzJmNWVjMGM5MGJkMzg5ZDc1OQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDhlNDVjOTdlNTNlMjg4ZmQ3MmNmZGU0NDJkNWM1ZGE0NDQxYTljNA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MmRjYmU2YzNhNzMyNTUyMTlkYTc2NTM4OTEyYTNkZTQ3MmMyMGQ2MTQ1OGQ3
|
10
|
-
YmM2MmM2NzdiNmRhNGU4Njc1ZTNlNTA4MzhlODJiMzUyMDg1ZmY1Y2VkMzAz
|
11
|
-
NzExMWRjNTk0NmU4MDkwNWVhMWZlYTE3NWI3MTQ2YTJkZTBkYTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Mzc1YTgwNGVhYjVhODM4YTRlOTdlMDI0NWQ2MDE2OTA4MTdiZjkwYjYwNzUx
|
14
|
-
OTUwYTRlZDQ3N2Q2N2RlYjJhM2UwMWJmNWYyZjk5ODJkNDU2M2YyMmVhNzli
|
15
|
-
OWE1MDhiYjYzMDg3MmE5ZTU2YTkxZmFkN2M1OWIyYTY2ZjJiY2I=
|