serverspec 0.10.9 → 0.10.10

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 786d45b783ec4c46202d247ba411dde39fdbdd8e
4
- data.tar.gz: 71b7a45043d23acfc5eb22a93625183b54b049ee
3
+ metadata.gz: a008c1561552e8f1bc6243120d9f618b2d19ed9b
4
+ data.tar.gz: 531d24bd0a077ab533884e0845e2e899d3d21890
5
5
  SHA512:
6
- metadata.gz: 3fc0ae40eb5aad049d418eab84f895bdc7b6b997345ce2cc04b6bc17084b4890a40c20bd0b1b9406929b441af04907e2daca64f00d4e7e2bb5990f8282dc6c38
7
- data.tar.gz: 14886297364fd75e2008b6d9ce0915c5e1b6884cabc0352044eedaa3d92eba483e3d8eaa11c88a88df7d66628c40b9338173f734628d7f2f8cc816f0cfcdfffb
6
+ metadata.gz: ccb7b9bbe3c3509cc0d072f944bc612e29a2f679dac4b2117ab470b0d4665c55567af0981e8d0b7b46583f1628ea9675cae14f2bbe2186b9439ce3c7e5cbae42
7
+ data.tar.gz: e21077caa656303a6cc902d9cdcbe0dd7d64a4903b1b44363be15bfa1aba1059bd65d182a7da5d35940e9d5aa9fa15644f4be989578bbf5b1c7c92f873a6448e
@@ -292,6 +292,14 @@ module Serverspec
292
292
  def get_file_content(file)
293
293
  "cat #{file}"
294
294
  end
295
+
296
+ def check_container(container)
297
+ raise NotImplementedError.new
298
+ end
299
+
300
+ def check_cotainer_running(container)
301
+ raise NotImplementedError.new
302
+ end
295
303
  end
296
304
  end
297
305
  end
@@ -56,6 +56,15 @@ module Serverspec
56
56
  commands.join(' && ')
57
57
  end
58
58
  end
59
+
60
+ def check_container(container)
61
+ "lxc-ls -1 | grep -w #{escape(container)}"
62
+ end
63
+
64
+ def check_container_running(container)
65
+ "lxc-info -n #{escape(container)} -t RUNNING"
66
+ end
67
+
59
68
  end
60
69
  end
61
70
  end
@@ -3,7 +3,7 @@ module Serverspec
3
3
  module Type
4
4
  types = %w(
5
5
  base cgroup command cron default_gateway file group host interface
6
- ipfilter ipnat iptables kernel_module linux_kernel_parameter mail_alias
6
+ ipfilter ipnat iptables kernel_module linux_kernel_parameter lxc mail_alias
7
7
  package php_config port routing_table selinux service user yumrepo
8
8
  windows_registry_key zfs
9
9
  )
@@ -0,0 +1,17 @@
1
+ module Serverspec
2
+ module Type
3
+ class Lxc < Base
4
+ def exists?
5
+ backend.check_container(@name)
6
+ end
7
+
8
+ def running?(under)
9
+ backend.check_container_running(@name)
10
+ end
11
+
12
+ def to_s
13
+ 'LXC'
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.10.9"
2
+ VERSION = "0.10.10"
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Debian'
5
+ end
6
+
7
+ describe lxc('ct01') do
8
+ it { should exist }
9
+ its(:command) { should eq "lxc-ls -1 | grep -w ct01" }
10
+ end
11
+
12
+ describe lxc('invalid-ct') do
13
+ it { should_not exist }
14
+ end
15
+
16
+ describe lxc('ct01') do
17
+ it { should be_running }
18
+ its(:command) { should eq "lxc-info -n ct01 -t RUNNING"}
19
+ end
20
+
21
+ describe lxc('invalid-ct') do
22
+ it { should_not be_running }
23
+ end
24
+
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Gentoo'
5
+ end
6
+
7
+ describe lxc('ct01') do
8
+ it { should exist }
9
+ its(:command) { should eq "lxc-ls -1 | grep -w ct01" }
10
+ end
11
+
12
+ describe lxc('invalid-ct') do
13
+ it { should_not exist }
14
+ end
15
+
16
+ describe lxc('ct01') do
17
+ it { should be_running }
18
+ its(:command) { should eq "lxc-info -n ct01 -t RUNNING"}
19
+ end
20
+
21
+ describe lxc('invalid-ct') do
22
+ it { should_not be_running }
23
+ end
24
+
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Plamo'
5
+ end
6
+
7
+ describe lxc('ct01') do
8
+ it { should exist }
9
+ its(:command) { should eq "lxc-ls -1 | grep -w ct01" }
10
+ end
11
+
12
+ describe lxc('invalid-ct') do
13
+ it { should_not exist }
14
+ end
15
+
16
+ describe lxc('ct01') do
17
+ it { should be_running }
18
+ its(:command) { should eq "lxc-info -n ct01 -t RUNNING"}
19
+ end
20
+
21
+ describe lxc('invalid-ct') do
22
+ it { should_not be_running }
23
+ end
24
+
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'RedHat'
5
+ end
6
+
7
+ describe lxc('ct01') do
8
+ it { should exist }
9
+ its(:command) { should eq "lxc-ls -1 | grep -w ct01" }
10
+ end
11
+
12
+ describe lxc('invalid-ct') do
13
+ it { should_not exist }
14
+ end
15
+
16
+ describe lxc('ct01') do
17
+ it { should be_running }
18
+ its(:command) { should eq "lxc-info -n ct01 -t RUNNING"}
19
+ end
20
+
21
+ describe lxc('invalid-ct') do
22
+ it { should_not be_running }
23
+ end
24
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.9
4
+ version: 0.10.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-18 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -189,6 +189,7 @@ files:
189
189
  - lib/serverspec/type/iptables.rb
190
190
  - lib/serverspec/type/kernel_module.rb
191
191
  - lib/serverspec/type/linux_kernel_parameter.rb
192
+ - lib/serverspec/type/lxc.rb
192
193
  - lib/serverspec/type/mail_alias.rb
193
194
  - lib/serverspec/type/package.rb
194
195
  - lib/serverspec/type/php_config.rb
@@ -245,6 +246,7 @@ files:
245
246
  - spec/debian/iptables_spec.rb
246
247
  - spec/debian/kernel_module_spec.rb
247
248
  - spec/debian/linux_kernel_parameter_spec.rb
249
+ - spec/debian/lxc_spec.rb
248
250
  - spec/debian/mail_alias_spec.rb
249
251
  - spec/debian/package_spec.rb
250
252
  - spec/debian/php_config_spec.rb
@@ -277,6 +279,7 @@ files:
277
279
  - spec/gentoo/iptables_spec.rb
278
280
  - spec/gentoo/kernel_module_spec.rb
279
281
  - spec/gentoo/linux_kernel_parameter_spec.rb
282
+ - spec/gentoo/lxc_spec.rb
280
283
  - spec/gentoo/mail_alias_spec.rb
281
284
  - spec/gentoo/package_spec.rb
282
285
  - spec/gentoo/php_config_spec.rb
@@ -298,6 +301,7 @@ files:
298
301
  - spec/plamo/iptables_spec.rb
299
302
  - spec/plamo/kernel_module_spec.rb
300
303
  - spec/plamo/linux_kernel_parameter_spec.rb
304
+ - spec/plamo/lxc_spec.rb
301
305
  - spec/plamo/mail_alias_spec.rb
302
306
  - spec/plamo/package_spec.rb
303
307
  - spec/plamo/php_config_spec.rb
@@ -318,6 +322,7 @@ files:
318
322
  - spec/redhat/iptables_spec.rb
319
323
  - spec/redhat/kernel_module_spec.rb
320
324
  - spec/redhat/linux_kernel_parameter_spec.rb
325
+ - spec/redhat/lxc_spec.rb
321
326
  - spec/redhat/mail_alias_spec.rb
322
327
  - spec/redhat/package_spec.rb
323
328
  - spec/redhat/php_config_spec.rb
@@ -442,6 +447,7 @@ test_files:
442
447
  - spec/debian/iptables_spec.rb
443
448
  - spec/debian/kernel_module_spec.rb
444
449
  - spec/debian/linux_kernel_parameter_spec.rb
450
+ - spec/debian/lxc_spec.rb
445
451
  - spec/debian/mail_alias_spec.rb
446
452
  - spec/debian/package_spec.rb
447
453
  - spec/debian/php_config_spec.rb
@@ -474,6 +480,7 @@ test_files:
474
480
  - spec/gentoo/iptables_spec.rb
475
481
  - spec/gentoo/kernel_module_spec.rb
476
482
  - spec/gentoo/linux_kernel_parameter_spec.rb
483
+ - spec/gentoo/lxc_spec.rb
477
484
  - spec/gentoo/mail_alias_spec.rb
478
485
  - spec/gentoo/package_spec.rb
479
486
  - spec/gentoo/php_config_spec.rb
@@ -495,6 +502,7 @@ test_files:
495
502
  - spec/plamo/iptables_spec.rb
496
503
  - spec/plamo/kernel_module_spec.rb
497
504
  - spec/plamo/linux_kernel_parameter_spec.rb
505
+ - spec/plamo/lxc_spec.rb
498
506
  - spec/plamo/mail_alias_spec.rb
499
507
  - spec/plamo/package_spec.rb
500
508
  - spec/plamo/php_config_spec.rb
@@ -515,6 +523,7 @@ test_files:
515
523
  - spec/redhat/iptables_spec.rb
516
524
  - spec/redhat/kernel_module_spec.rb
517
525
  - spec/redhat/linux_kernel_parameter_spec.rb
526
+ - spec/redhat/lxc_spec.rb
518
527
  - spec/redhat/mail_alias_spec.rb
519
528
  - spec/redhat/package_spec.rb
520
529
  - spec/redhat/php_config_spec.rb