linux-lxc 0.0.3 → 0.0.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 +4 -4
- data/lib/linux/lxc/version.rb +1 -1
- data/lib/linux/lxc.rb +10 -4
- data/test/linux_lxc_test.rb +27 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b046b82ebb5b24db19f4e93d53ee8c7b932f44b
|
4
|
+
data.tar.gz: 3fe3961749468474f2e673f45b283ab7e3db50ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b848e1d55edd2edbe26290c0f0f325baab67a8551887a7afa5636480faa960059ffc25065bf0b2f06bd080c121cee10d0d8ee03526c12a9c1ac007e92622ff
|
7
|
+
data.tar.gz: beb3d9773ef16949070c2816fc02be8714f1e4757e32d391944eabb9d2fae75d09effead7b7ec4df7f085ab0b0d35e9229e4aff36d2b126d0bcf31aea0e0dc1c
|
data/lib/linux/lxc/version.rb
CHANGED
data/lib/linux/lxc.rb
CHANGED
@@ -73,15 +73,21 @@ module Linux
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
attr_reader :index, :lines
|
77
|
-
attr_accessor :
|
76
|
+
attr_reader :index, :lines, :file
|
77
|
+
attr_accessor :real_fname
|
78
78
|
|
79
79
|
def initialize(file, index = {})
|
80
|
-
|
80
|
+
self.file = file
|
81
81
|
@lines = Lines.new
|
82
82
|
@index = index
|
83
83
|
end
|
84
84
|
|
85
|
+
# file is more important than real_fname
|
86
|
+
def file=(a)
|
87
|
+
@file = a
|
88
|
+
@real_fname = a
|
89
|
+
end
|
90
|
+
|
85
91
|
def get(key)
|
86
92
|
@index[key]
|
87
93
|
end
|
@@ -136,7 +142,7 @@ module Linux
|
|
136
142
|
end
|
137
143
|
|
138
144
|
def write
|
139
|
-
File.open(
|
145
|
+
File.open(real_fname, 'w') do |f|
|
140
146
|
@lines.each do |line|
|
141
147
|
if line.key == "lxc.include"
|
142
148
|
line.value.write
|
data/test/linux_lxc_test.rb
CHANGED
@@ -177,6 +177,33 @@ SAMPLE
|
|
177
177
|
|
178
178
|
end
|
179
179
|
|
180
|
+
def test_real_fname
|
181
|
+
lxc = Linux::Lxc.new(File.join(@temp_dir, "real_name"))
|
182
|
+
lxc.add("# base meno")
|
183
|
+
lxc.add("lxc.cgroup.devices.allow", "meno")
|
184
|
+
lxc.write
|
185
|
+
lxc.real_fname = File.join(@temp_dir, "test_name")
|
186
|
+
incl = Linux::Lxc.new(File.join(@temp_dir, "test_incl"))
|
187
|
+
incl.real_fname = File.join(@temp_dir, "real_incl")
|
188
|
+
lxc.add("lxc.include", incl)
|
189
|
+
incl.add("# include meno")
|
190
|
+
incl.add("lxc.network.hwaddr", '00:16:3e:67:03:4a')
|
191
|
+
lxc.write
|
192
|
+
assert_equal File.exists?(File.join(@temp_dir, "test_name")), true
|
193
|
+
assert_equal File.exists?(File.join(@temp_dir, "real_name")), true
|
194
|
+
assert_equal File.exists?(File.join(@temp_dir, "real_incl")), true
|
195
|
+
assert_equal File.exists?(File.join(@temp_dir, "test_incl")), false
|
196
|
+
# assert_raise do #Fails, no Exceptions are raised
|
197
|
+
begin
|
198
|
+
lxc = Linux::Lxc.parse(File.join(@temp_dir, "test_name"))
|
199
|
+
assert_equal "Doof", "Darf nie passieren"
|
200
|
+
rescue Exception => e
|
201
|
+
assert_equal e.instance_of?(Errno::ENOENT), true
|
202
|
+
assert_equal File.basename(e.message), "test_incl"
|
203
|
+
end
|
204
|
+
# end
|
205
|
+
end
|
206
|
+
|
180
207
|
def test_lines
|
181
208
|
lxc = Linux::Lxc.parse(@lxc_config)
|
182
209
|
cnt = 0
|