serverspec 2.41.5 → 2.42.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c1fd50d20575e8df2a43fd77526b1f64cf2cd67
4
- data.tar.gz: 059832ec274b1ec8c380533fb89e84a14ba9c5d6
3
+ metadata.gz: 2e7e6937d32bae901dced0203e3521b5bf78e7b5
4
+ data.tar.gz: 9f37164c1c0288c7759ca7a3541cf6474a3d16f2
5
5
  SHA512:
6
- metadata.gz: 61dca279925253ed95fc21330613c21fd16b30acd669720cfdf6edbe851beb056f92246cb20081059ab804471d6f5f046984b1f897adb09e5113c0cc806acabd
7
- data.tar.gz: 40b3ac40bbd38b6a71ced13930de75ce29290f225a63e65a018cb1643c506f4f75c2dd1c3ad1ae2a7270488586695255083e4b0e74dd2ac81ce2e7370cab12c2
6
+ metadata.gz: a11a4a768849ead513cc6b0b35423245a3d3861a6dab4d17f31fcd7e7b7c5f9cb0a8de43d73026969af98513b63e7acdb851491d3ed28f0602f96fc12f5610b9
7
+ data.tar.gz: ed280d208fe94358bc18163029868dd4f39a102eaaf2301cf1c992d9132ded79aa3f16c76488e4f3ad33e6f5e80a0db46830a745b3ddc8fea145802f6adbbab3
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.8.7
5
4
  - 1.9.3
6
5
  - 2.0.0
7
6
  - 2.1.1
@@ -18,6 +17,7 @@ before_install:
18
17
  script:
19
18
  - bundle exec rake spec
20
19
 
20
+ dist: trusty
21
21
  sudo: false
22
22
  cache: bundler
23
23
  notifications:
data/appveyor.yml CHANGED
@@ -59,6 +59,7 @@ install:
59
59
  - ps: $PSVersionTable
60
60
 
61
61
  build_script:
62
+ - set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
62
63
  - ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exists?(File.join(Gem.dir, "cache", "bundler"))'
63
64
  - bundle install --jobs 3 --retry 3
64
65
  - net user
@@ -18,9 +18,14 @@ module Serverspec::Type
18
18
  command_result.exit_status.to_i
19
19
  end
20
20
 
21
+ protected
22
+ def command
23
+ @name
24
+ end
25
+
21
26
  private
22
27
  def command_result()
23
- @command_result ||= @runner.run_command(@name)
28
+ @command_result ||= @runner.run_command(command)
24
29
  end
25
30
  end
26
31
  end
@@ -4,6 +4,10 @@ module Serverspec::Type
4
4
  @runner.check_group_exists(@name)
5
5
  end
6
6
 
7
+ def gid
8
+ @runner.get_group_gid(@name).stdout.to_i
9
+ end
10
+
7
11
  def has_gid?(gid)
8
12
  @runner.check_group_has_gid(@name, gid)
9
13
  end
@@ -12,6 +12,10 @@ module Serverspec::Type
12
12
  @runner.check_user_belongs_to_primary_group(@name, group)
13
13
  end
14
14
 
15
+ def uid
16
+ @runner.get_user_uid(@name).stdout.to_i
17
+ end
18
+
15
19
  def has_uid?(uid)
16
20
  @runner.check_user_has_uid(@name, uid)
17
21
  end
@@ -7,11 +7,11 @@ module Serverspec::Type
7
7
  end
8
8
 
9
9
  def subject
10
- run_openssl_command_with("-subject -noout").stdout.chomp.gsub(/^subject= */,'')
10
+ normalize_dn(run_openssl_command_with("-subject -noout").stdout.chomp.gsub(/^subject= */,''))
11
11
  end
12
12
 
13
13
  def issuer
14
- run_openssl_command_with("-issuer -noout").stdout.chomp.gsub(/^issuer= */,'')
14
+ normalize_dn(run_openssl_command_with("-issuer -noout").stdout.chomp.gsub(/^issuer= */,''))
15
15
  end
16
16
 
17
17
  def email
@@ -81,5 +81,12 @@ module Serverspec::Type
81
81
  res.merge({ kv_arr[0].to_sym => time })
82
82
  end
83
83
  end
84
+
85
+ # Normalize output between openssl versions.
86
+ def normalize_dn(dn)
87
+ return dn unless dn.start_with?('/')
88
+ # normalize openssl < 1.1 to >= 1.1 output
89
+ dn[1..-1].split('/').join(', ').gsub('=', ' = ')
90
+ end
84
91
  end
85
92
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "2.41.5"
2
+ VERSION = "2.42.0"
3
3
  end
@@ -9,3 +9,8 @@ end
9
9
  describe group('root') do
10
10
  it { should have_gid 0 }
11
11
  end
12
+
13
+ describe group('root') do
14
+ its(:gid) { should == 0 }
15
+ its(:gid) { should < 10 }
16
+ end
@@ -18,6 +18,11 @@ describe user('root') do
18
18
  it { should have_uid 0 }
19
19
  end
20
20
 
21
+ describe user('root') do
22
+ its(:uid) { should == 0 }
23
+ its(:uid) { should < 10 }
24
+ end
25
+
21
26
  describe user('root') do
22
27
  it { should have_login_shell '/bin/bash' }
23
28
  end
@@ -12,14 +12,24 @@ describe x509_certificate('test.pem') do
12
12
  it { should_not be_certificate }
13
13
  end
14
14
 
15
- describe x509_certificate('test.pem') do
16
- let(:stdout) { sample_subj }
17
- its(:subject) { should eq '/O=some/OU=thing' }
15
+ describe x509_certificate('test-openssl-1.0.pem') do
16
+ let(:stdout) { sample_subj_openssl_1_0 }
17
+ its(:subject) { should eq 'O = some, OU = thing' }
18
18
  end
19
19
 
20
- describe x509_certificate('test.pem') do
21
- let(:stdout) { sample_issuer }
22
- its(:issuer) { should eq '/O=some/OU=issuer' }
20
+ describe x509_certificate('test-openssl-1.1.pem') do
21
+ let(:stdout) { sample_subj_openssl_1_1 }
22
+ its(:subject) { should eq 'O = some, OU = thing' }
23
+ end
24
+
25
+ describe x509_certificate('test-openssl-1.0.pem') do
26
+ let(:stdout) { sample_issuer_openssl_1_0 }
27
+ its(:issuer) { should eq 'O = some, OU = issuer' }
28
+ end
29
+
30
+ describe x509_certificate('test-openssl-1.1.pem') do
31
+ let(:stdout) { sample_issuer_openssl_1_1 }
32
+ its(:issuer) { should eq 'O = some, OU = issuer' }
23
33
  end
24
34
 
25
35
  describe x509_certificate('test.pem') do
@@ -38,18 +48,30 @@ describe x509_certificate('test.pem') do
38
48
  its(:subject_alt_names) { should eq %w[DNS:*.example.com DNS:www.example.net IP:192.0.2.10] }
39
49
  end
40
50
 
41
- def sample_subj
51
+ def sample_subj_openssl_1_0
42
52
  <<'EOS'
43
53
  subject= /O=some/OU=thing
44
54
  EOS
45
55
  end
46
56
 
47
- def sample_issuer
57
+ def sample_subj_openssl_1_1
58
+ <<'EOS'
59
+ subject=O = some, OU = thing
60
+ EOS
61
+ end
62
+
63
+ def sample_issuer_openssl_1_0
48
64
  <<'EOS'
49
65
  issuer= /O=some/OU=issuer
50
66
  EOS
51
67
  end
52
68
 
69
+ def sample_issuer_openssl_1_1
70
+ <<'EOS'
71
+ issuer=O = some, OU = issuer
72
+ EOS
73
+ end
74
+
53
75
  def sample_validity
54
76
  <<'EOS'
55
77
  notBefore=Jul 1 11:11:00 2000 GMT
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: 2.41.5
4
+ version: 2.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-18 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -306,7 +306,7 @@ homepage: http://serverspec.org/
306
306
  licenses:
307
307
  - MIT
308
308
  metadata: {}
309
- post_install_message:
309
+ post_install_message:
310
310
  rdoc_options: []
311
311
  require_paths:
312
312
  - lib
@@ -321,9 +321,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  - !ruby/object:Gem::Version
322
322
  version: '0'
323
323
  requirements: []
324
- rubyforge_project:
325
- rubygems_version: 2.2.2
326
- signing_key:
324
+ rubyforge_project:
325
+ rubygems_version: 2.5.1
326
+ signing_key:
327
327
  specification_version: 4
328
328
  summary: RSpec tests for your servers configured by Puppet, Chef, Itamae or anything
329
329
  else