lxc 0.3.7 → 0.4.0

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.
@@ -10,4 +10,10 @@ rvm:
10
10
  before_install: sudo ./spec/support/install-lxc.sh
11
11
 
12
12
  notifications:
13
- irc: "irc.freenode.net#jovelabs"
13
+ email:
14
+ recipients:
15
+ - testlab-ci@lookout.com
16
+ on_success: always
17
+ on_failure: always
18
+ irc:
19
+ - "irc.freenode.net#jovelabs"
data/Gemfile CHANGED
@@ -7,4 +7,8 @@ if (RUBY_VERSION < "1.9.3")
7
7
  gem "redcarpet", "< 3.0.0"
8
8
  end
9
9
 
10
+ if (RUBY_VERSION < "1.9.2")
11
+ gem "mime-types", "< 2.0"
12
+ end
13
+
10
14
  gemspec
@@ -316,13 +316,19 @@ class LXC
316
316
  # Current Memory Usage
317
317
  def memory_usage
318
318
  result = self.exec(%(lxc-cgroup), %(memory.usage_in_bytes))
319
- result.empty? ? 0 : result.to_i
319
+ (result.empty? ? 0 : result.to_i)
320
320
  end
321
321
 
322
322
  # CPU Time in Seconds
323
323
  def cpu_usage
324
324
  result = self.exec(%(lxc-cgroup), %(cpuacct.usage))
325
- result.empty? ? 0 : (result.to_i / 1E9).to_i
325
+ (result.empty? ? 0 : (result.to_i / 1E9).to_i)
326
+ end
327
+
328
+ # Current Disk Usage
329
+ def disk_usage(ephemeral=false)
330
+ result = (@lxc.exec(%(du -sb #{self.fs_root(ephemeral)})).split.first rescue nil)
331
+ ((result.nil? || result.empty?) ? 0 : result.to_i)
326
332
  end
327
333
 
328
334
  # Linux container command execution wrapper
@@ -2,7 +2,7 @@ class LXC
2
2
 
3
3
  unless const_defined?(:VERSION)
4
4
  # LXC Gem Version
5
- VERSION = "0.3.7"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
 
8
8
  end
@@ -167,6 +167,8 @@ describe LXC do
167
167
 
168
168
  describe "#inspect" do
169
169
  it "should return an information string about our class instance" do
170
+ subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-version.out") }
171
+
170
172
  subject.inspect.should be_kind_of(String)
171
173
  subject.inspect.length.should be > 0
172
174
  end
@@ -178,7 +180,7 @@ describe LXC do
178
180
  it "should exec the supplied LXC command" do
179
181
  subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-version.out") }
180
182
 
181
- subject.exec("version").should be_kind_of(String)
183
+ subject.exec("lxc-version").should be_kind_of(String)
182
184
  end
183
185
  end
184
186
 
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.3.7
4
+ version: 0.4.0
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-09-17 00:00:00.000000000 Z
12
+ date: 2013-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ztk
@@ -219,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  segments:
221
221
  - 0
222
- hash: 219836670546765976
222
+ hash: 3922610314625450617
223
223
  required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  none: false
225
225
  requirements:
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  segments:
230
230
  - 0
231
- hash: 219836670546765976
231
+ hash: 3922610314625450617
232
232
  requirements: []
233
233
  rubyforge_project:
234
234
  rubygems_version: 1.8.25