lxc 0.2.8 → 0.2.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.
- data/lib/lxc/container.rb +2 -2
- data/lib/lxc/version.rb +1 -1
- data/lib/lxc.rb +7 -3
- data/spec/lxc/container_spec.rb +12 -0
- metadata +4 -4
data/lib/lxc/container.rb
CHANGED
@@ -113,12 +113,12 @@ class LXC
|
|
113
113
|
|
114
114
|
# Start the container
|
115
115
|
#
|
116
|
-
# Runs the "lxc-start" command
|
116
|
+
# Runs the "lxc-start" command.
|
117
117
|
#
|
118
118
|
# @param [Array] args Additional command-line arguments.
|
119
119
|
# @return [Array<String>] Lines of output from the executed command.
|
120
120
|
def start(*args)
|
121
|
-
self.exec("lxc-start",
|
121
|
+
self.exec("lxc-start", *args)
|
122
122
|
end
|
123
123
|
|
124
124
|
# Start an ephemeral copy of the container
|
data/lib/lxc/version.rb
CHANGED
data/lib/lxc.rb
CHANGED
@@ -172,10 +172,14 @@ class LXC
|
|
172
172
|
output = Array.new
|
173
173
|
|
174
174
|
if @use_ssh.nil?
|
175
|
-
|
176
|
-
|
177
|
-
|
175
|
+
begin
|
176
|
+
::ZTK::PTY.spawn(arguments) do |reader, writer, pid|
|
177
|
+
while (buffer = reader.readpartial(1024))
|
178
|
+
output << buffer
|
179
|
+
end
|
178
180
|
end
|
181
|
+
rescue EOFError
|
182
|
+
# NOOP
|
179
183
|
end
|
180
184
|
else
|
181
185
|
if @use_ssh.is_a?(ZTK::SSH)
|
data/spec/lxc/container_spec.rb
CHANGED
@@ -50,6 +50,7 @@ describe LXC::Container do
|
|
50
50
|
|
51
51
|
describe "#not_created?" do
|
52
52
|
it "should return true for an un-created container" do
|
53
|
+
subject.stub(:exists?) { false }
|
53
54
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
54
55
|
|
55
56
|
subject.not_created?.should == true
|
@@ -58,6 +59,7 @@ describe LXC::Container do
|
|
58
59
|
|
59
60
|
describe "#stopped?" do
|
60
61
|
it "should return true for an un-created container" do
|
62
|
+
subject.stub(:exists?) { false }
|
61
63
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
62
64
|
|
63
65
|
subject.stopped?.should == false
|
@@ -66,6 +68,7 @@ describe LXC::Container do
|
|
66
68
|
|
67
69
|
describe "#starting?" do
|
68
70
|
it "should return false for an un-created container" do
|
71
|
+
subject.stub(:exists?) { false }
|
69
72
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
70
73
|
|
71
74
|
subject.starting?.should == false
|
@@ -74,6 +77,7 @@ describe LXC::Container do
|
|
74
77
|
|
75
78
|
describe "#running?" do
|
76
79
|
it "should return false for an un-created container" do
|
80
|
+
subject.stub(:exists?) { false }
|
77
81
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
78
82
|
|
79
83
|
subject.running?.should == false
|
@@ -82,6 +86,7 @@ describe LXC::Container do
|
|
82
86
|
|
83
87
|
describe "#stopping?" do
|
84
88
|
it "should return false for an un-created container" do
|
89
|
+
subject.stub(:exists?) { false }
|
85
90
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
86
91
|
|
87
92
|
subject.stopping?.should == false
|
@@ -90,6 +95,7 @@ describe LXC::Container do
|
|
90
95
|
|
91
96
|
describe "#aborting?" do
|
92
97
|
it "should return false for an un-created container" do
|
98
|
+
subject.stub(:exists?) { false }
|
93
99
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
94
100
|
|
95
101
|
subject.aborting?.should == false
|
@@ -98,6 +104,7 @@ describe LXC::Container do
|
|
98
104
|
|
99
105
|
describe "#freezing?" do
|
100
106
|
it "should return false for an un-created container" do
|
107
|
+
subject.stub(:exists?) { false }
|
101
108
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
102
109
|
|
103
110
|
subject.freezing?.should == false
|
@@ -106,6 +113,7 @@ describe LXC::Container do
|
|
106
113
|
|
107
114
|
describe "#frozen?" do
|
108
115
|
it "should return false for an un-created container" do
|
116
|
+
subject.stub(:exists?) { false }
|
109
117
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
110
118
|
|
111
119
|
subject.frozen?.should == false
|
@@ -114,6 +122,7 @@ describe LXC::Container do
|
|
114
122
|
|
115
123
|
describe "#thawed?" do
|
116
124
|
it "should return false for an un-created container" do
|
125
|
+
subject.stub(:exists?) { false }
|
117
126
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
118
127
|
|
119
128
|
subject.thawed?.should == false
|
@@ -122,6 +131,7 @@ describe LXC::Container do
|
|
122
131
|
|
123
132
|
describe "#exists?" do
|
124
133
|
it "should return false for an un-created container" do
|
134
|
+
subject.stub(:exists?) { false }
|
125
135
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-ls-wo-containers.out") }
|
126
136
|
|
127
137
|
subject.exists?.should == false
|
@@ -138,12 +148,14 @@ describe LXC::Container do
|
|
138
148
|
|
139
149
|
describe "#state" do
|
140
150
|
it "should return not_created for an un-created container" do
|
151
|
+
subject.stub(:exists?) { false }
|
141
152
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-info-state-stopped.out") }
|
142
153
|
|
143
154
|
subject.state.should == :not_created
|
144
155
|
end
|
145
156
|
|
146
157
|
it "should return unknown for a created but missing container" do
|
158
|
+
subject.lxc.stub(:exists?) { true }
|
147
159
|
subject.lxc.stub(:exec) { lxc_fixture(lxc_version, "lxc-ls-w-containers.out") }
|
148
160
|
|
149
161
|
subject.state.should == :unknown
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lxc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ztk
|
@@ -216,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
216
|
version: '0'
|
217
217
|
segments:
|
218
218
|
- 0
|
219
|
-
hash:
|
219
|
+
hash: 3536406914803373150
|
220
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
221
|
none: false
|
222
222
|
requirements:
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '0'
|
226
226
|
segments:
|
227
227
|
- 0
|
228
|
-
hash:
|
228
|
+
hash: 3536406914803373150
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
231
|
rubygems_version: 1.8.25
|