serverspec 0.10.4 → 0.10.5

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: 2e129075cf8dab2aa89c0d5b0c2995a301c3e032
4
- data.tar.gz: 410f4266d33bcbb3ac5df1c2ad2162cb5f9c8954
3
+ metadata.gz: dcb9f644fd856ee0aab06fe035f9bed7af778f61
4
+ data.tar.gz: 608dc6ee8cc695b3fb48f3426303245c51c63f98
5
5
  SHA512:
6
- metadata.gz: b62a181c674d1cdb217fb48af4749f1e8bba0c90aefcd21c6639d2a92b9f7ab64574f1dd5fd405ec7b646ffeb2ec21788b55e748e1d3721b69c8e4157b6c4bda
7
- data.tar.gz: 5c631ed3134c89c3617c96d765c53849ab5d006d5c682a395f82c8b0d708e819b1d7f5df69896b07aac598c4e493205d78d9e25cde1c86d56866f3e5c030d5f0
6
+ metadata.gz: cf6c417482127ec3ceca5363de2488829644212f028a67e4601b3c196e72952c65449774d09dc0bf3d7a6b212f564c847d1ca53eafabda8f0549b8e72aeba1f5
7
+ data.tar.gz: 520fa26e75439d84da59aa679db5e42bfa8184dcabad1a745dc3889bcac9f14400955390ffaa61c81a4be4ad6044b8e067e354dc38bf9b9f64033a36cfe3dda2
data/.gitignore CHANGED
@@ -22,4 +22,5 @@ test/version_tmp
22
22
  tmp
23
23
  Vagrantfile
24
24
  vendor/
25
- .DS_Store
25
+ .DS_Store
26
+ Gemfile.local
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in serverspec.gemspec
4
4
  gemspec
5
+
6
+ # Put Gemfile.local to use arbitrary gems for your use case.
7
+ path = Pathname.new("Gemfile.local")
8
+ eval(path.read) if path.exist?
@@ -50,7 +50,7 @@ module Serverspec
50
50
  end
51
51
 
52
52
  def check_mode(file, mode)
53
- false unless sprintf("%o",File.stat(file).mode).slice!(3,3) == mode
53
+ raise NotImplementedError.new
54
54
  end
55
55
 
56
56
  def check_owner(file, owner)
@@ -2,9 +2,10 @@ module Serverspec
2
2
  module Helper
3
3
  module Type
4
4
  types = %w(
5
- base yumrepo service package port file cron command linux_kernel_parameter iptables host
6
- routing_table default_gateway selinux user group zfs ipnat ipfilter kernel_module interface php_config
7
- mail_alias windows_registry_key
5
+ base cgroup command cron default_gateway file group host interface
6
+ ipfilter ipnat iptables kernel_module linux_kernel_parameter mail_alias
7
+ package php_config port routing_table selinux service user yumrepo
8
+ windows_registry_key zfs
8
9
  )
9
10
 
10
11
  types.each {|type| require "serverspec/type/#{type}" }
@@ -0,0 +1,19 @@
1
+ module Serverspec
2
+ module Type
3
+ class Cgroup < Base
4
+ attr_accessor :subsystem
5
+ def method_missing(meth)
6
+ if @subsystem.nil?
7
+ @subsystem = meth.to_s
8
+ return self
9
+ else
10
+ param = "#{@subsystem}.#{meth.to_s}"
11
+ ret = backend.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
12
+ val = ret[:stdout].strip
13
+ val = val.to_i if val.match(/^\d+$/)
14
+ val
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.10.4"
2
+ VERSION = "0.10.5"
3
3
  end
@@ -72,10 +72,6 @@ describe file('/etc/ssh/sshd_config') do
72
72
  it { should_not contain('This is invalid text!!').before(/^end/) }
73
73
  end
74
74
 
75
- describe file('/etc/passwd') do
76
- it { should be_mode 644 }
77
- end
78
-
79
75
  describe file('/etc/passwd') do
80
76
  it { should be_owned_by 'root' }
81
77
  its(:command) { should eq "ls -al /etc/passwd | awk '{print $3}' | grep -- \\^root\\$" }
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Debian'
5
+ end
6
+
7
+ describe cgroup('group1') do
8
+ let(:stdout) { "1\r\n" }
9
+ its('cpuset.cpus') { should eq 1 }
10
+ its(:command) { should eq "cgget -n -r cpuset.cpus group1 | awk '{print $2}'" }
11
+ end
12
+
13
+ describe cgroup('group1') do
14
+ let(:stdout) { "1\r\n" }
15
+ its('cpuset.cpus') { should_not eq 0 }
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Gentoo'
5
+ end
6
+
7
+ describe cgroup('group1') do
8
+ let(:stdout) { "1\r\n" }
9
+ its('cpuset.cpus') { should eq 1 }
10
+ its(:command) { should eq "cgget -n -r cpuset.cpus group1 | awk '{print $2}'" }
11
+ end
12
+
13
+ describe cgroup('group1') do
14
+ let(:stdout) { "1\r\n" }
15
+ its('cpuset.cpus') { should_not eq 0 }
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'RedHat'
5
+ end
6
+
7
+ describe cgroup('group1') do
8
+ let(:stdout) { "1\r\n" }
9
+ its('cpuset.cpus') { should eq 1 }
10
+ its(:command) { should eq "cgget -n -r cpuset.cpus group1 | awk '{print $2}'" }
11
+ end
12
+
13
+ describe cgroup('group1') do
14
+ let(:stdout) { "1\r\n" }
15
+ its('cpuset.cpus') { should_not eq 0 }
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.configure do |c|
4
+ c.os = 'Debian'
5
+ end
6
+
7
+ describe cgroup('group1') do
8
+ let(:stdout) { "1\r\n" }
9
+ its('cpuset.cpus') { should eq 1 }
10
+ its(:command) { should eq "cgget -n -r cpuset.cpus group1 | awk '{print $2}'" }
11
+ end
12
+
13
+ describe cgroup('group1') do
14
+ let(:stdout) { "1\r\n" }
15
+ its('cpuset.cpus') { should_not eq 0 }
16
+ end
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.4
4
+ version: 0.10.5
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-14 00:00:00.000000000 Z
11
+ date: 2013-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -176,6 +176,7 @@ files:
176
176
  - lib/serverspec/setup.rb
177
177
  - lib/serverspec/subject.rb
178
178
  - lib/serverspec/type/base.rb
179
+ - lib/serverspec/type/cgroup.rb
179
180
  - lib/serverspec/type/command.rb
180
181
  - lib/serverspec/type/cron.rb
181
182
  - lib/serverspec/type/default_gateway.rb
@@ -233,6 +234,7 @@ files:
233
234
  - spec/darwin/routing_table_spec.rb
234
235
  - spec/darwin/service_spec.rb
235
236
  - spec/darwin/user_spec.rb
237
+ - spec/debian/cgroup_spec.rb
236
238
  - spec/debian/command_spec.rb
237
239
  - spec/debian/cron_spec.rb
238
240
  - spec/debian/default_gateway_spec.rb
@@ -264,6 +266,7 @@ files:
264
266
  - spec/freebsd/routing_table_spec.rb
265
267
  - spec/freebsd/service_spec.rb
266
268
  - spec/freebsd/user_spec.rb
269
+ - spec/gentoo/cgroup_spec.rb
267
270
  - spec/gentoo/command_spec.rb
268
271
  - spec/gentoo/cron_spec.rb
269
272
  - spec/gentoo/default_gateway_spec.rb
@@ -284,6 +287,7 @@ files:
284
287
  - spec/gentoo/user_spec.rb
285
288
  - spec/gentoo/zfs_spec.rb
286
289
  - spec/helpers/attributes_spec.rb
290
+ - spec/plamo/cgroup_spec.rb
287
291
  - spec/plamo/command_spec.rb
288
292
  - spec/plamo/cron_spec.rb
289
293
  - spec/plamo/default_gateway_spec.rb
@@ -304,6 +308,7 @@ files:
304
308
  - spec/plamo/service_spec.rb.plamo
305
309
  - spec/plamo/user_spec.rb
306
310
  - spec/plamo/zfs_spec.rb
311
+ - spec/redhat/cgroup_spec.rb
307
312
  - spec/redhat/command_spec.rb
308
313
  - spec/redhat/commands_spec.rb
309
314
  - spec/redhat/cron_spec.rb
@@ -428,6 +433,7 @@ test_files:
428
433
  - spec/darwin/routing_table_spec.rb
429
434
  - spec/darwin/service_spec.rb
430
435
  - spec/darwin/user_spec.rb
436
+ - spec/debian/cgroup_spec.rb
431
437
  - spec/debian/command_spec.rb
432
438
  - spec/debian/cron_spec.rb
433
439
  - spec/debian/default_gateway_spec.rb
@@ -459,6 +465,7 @@ test_files:
459
465
  - spec/freebsd/routing_table_spec.rb
460
466
  - spec/freebsd/service_spec.rb
461
467
  - spec/freebsd/user_spec.rb
468
+ - spec/gentoo/cgroup_spec.rb
462
469
  - spec/gentoo/command_spec.rb
463
470
  - spec/gentoo/cron_spec.rb
464
471
  - spec/gentoo/default_gateway_spec.rb
@@ -479,6 +486,7 @@ test_files:
479
486
  - spec/gentoo/user_spec.rb
480
487
  - spec/gentoo/zfs_spec.rb
481
488
  - spec/helpers/attributes_spec.rb
489
+ - spec/plamo/cgroup_spec.rb
482
490
  - spec/plamo/command_spec.rb
483
491
  - spec/plamo/cron_spec.rb
484
492
  - spec/plamo/default_gateway_spec.rb
@@ -499,6 +507,7 @@ test_files:
499
507
  - spec/plamo/service_spec.rb.plamo
500
508
  - spec/plamo/user_spec.rb
501
509
  - spec/plamo/zfs_spec.rb
510
+ - spec/redhat/cgroup_spec.rb
502
511
  - spec/redhat/command_spec.rb
503
512
  - spec/redhat/commands_spec.rb
504
513
  - spec/redhat/cron_spec.rb