serverspec 2.41.3 → 2.42.2

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: cb26e2d4cc304c82ee8478df2e7df998b62157b6
4
- data.tar.gz: 4b27d9fca13ac961f28c7e2e88cb7335b0addb62
3
+ metadata.gz: c156dac47ae252c7876fed18522aa9c196b049c7
4
+ data.tar.gz: b9e362ca6c5007250f147561f5aec4cbfd76885b
5
5
  SHA512:
6
- metadata.gz: f57de9c2728bcd8c52b39ad01eaf4946bea022a8695ea31a9e0074da7c36df7a33519bdbde23546f9b225e37db0b6a8f9f4430415d84525e1e6a9f0ed4b6bc23
7
- data.tar.gz: 9bf5be62880f63c99d149f32f9654300d24749419ae68fd7fc11572e4d004a59edd09f32797fa8fddcda3481ecf3d0557880c3a5a6890054c9c876f462459407
6
+ metadata.gz: 302deda1271e22b0fc451bf7200c4dd8c6bc13626ecafefce5e324ce5c2186c1cefde07d89291def7ec876bb57b08718677eff32c57782f4f0296567faefae77
7
+ data.tar.gz: 9016eced88bd4a9302460c2dbe319f156f48b9b744db8d0542f4e7a89b5def248d48dc34633af84b29e6adb404d628cfce476558e3b6ecc6b7eb4ee8c1a14d92
data/.github/stale.yml ADDED
@@ -0,0 +1,18 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
18
+
data/.travis.yml CHANGED
@@ -1,19 +1,23 @@
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
8
7
  - 2.2.4
9
- - 2.3.0
8
+ - 2.3.6
9
+ - 2.4.3
10
+ - 2.5.0
10
11
 
11
12
  before_install:
12
- - gem update bundler
13
+ - travis_retry gem update --system 2.7.8
14
+ - travis_retry gem install bundler -v 1.17.3
15
+ - travis_retry gem uninstall -i /home/travis/.rvm/gems/ruby-2.3.7@global bundler || echo
13
16
 
14
17
  script:
15
18
  - bundle exec rake spec
16
19
 
20
+ dist: trusty
17
21
  sudo: false
18
22
  cache: bundler
19
23
  notifications:
data/WINDOWS_SUPPORT.md CHANGED
@@ -26,8 +26,21 @@ user = <username>
26
26
  pass = <password>
27
27
  endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
28
28
 
29
- winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
30
- winrm.set_timeout 300 # 5 minutes max timeout for any operation
29
+ if Gem::Version.new(WinRM::VERSION) < Gem::Version.new('2')
30
+ winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
31
+ winrm.set_timeout 300 # 5 minutes max timeout for any operation
32
+ else
33
+ opts = {
34
+ user: user,
35
+ password: pass,
36
+ endpoint: endpoint,
37
+ operation_timeout: 300,
38
+ no_ssl_peer_verification: false,
39
+ }
40
+
41
+ winrm = ::WinRM::Connection.new(opts)
42
+ end
43
+
31
44
  Specinfra.configuration.winrm = winrm
32
45
  ```
33
46
 
data/appveyor.yml CHANGED
@@ -14,6 +14,9 @@ environment:
14
14
  - ruby_version: "21"
15
15
  - ruby_version: "22"
16
16
  - ruby_version: "23"
17
+ - ruby_version: "24"
18
+ - ruby_version: "25"
19
+ - ruby_version: "26"
17
20
 
18
21
  matrix:
19
22
  allow_failures:
@@ -32,6 +35,12 @@ cache:
32
35
  - C:\Ruby22\bin -> appveyor.yml
33
36
  - C:\Ruby23\lib\ruby\gems\2.2.0 -> appveyor.yml
34
37
  - C:\Ruby23\bin -> appveyor.yml
38
+ - C:\Ruby24\lib\ruby\gems\2.4.0 -> appveyor.yml
39
+ - C:\Ruby24\bin -> appveyor.yml
40
+ - C:\Ruby25\lib\ruby\gems\2.5.0 -> appveyor.yml
41
+ - C:\Ruby25\bin -> appveyor.yml
42
+ - C:\Ruby26\lib\ruby\gems\2.6.0 -> appveyor.yml
43
+ - C:\Ruby26\bin
35
44
 
36
45
  install:
37
46
  - git submodule update --init --recursive
@@ -46,11 +55,12 @@ install:
46
55
  - ruby --version
47
56
  - gem --version
48
57
  - appveyor DownloadFile -Url %bundler_url% -FileName bundler.gem
49
- - gem install --local bundler.gem --no-ri --no-rdoc ## appveyor often stops `gem install bundler`..?
58
+ - gem install --local bundler.gem --no-document --force ## appveyor often stops `gem install bundler`..?
50
59
  - ps: $PSVersionTable
51
60
 
52
61
  build_script:
53
- - ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exists?(File.join(Gem.dir, "cache", "bundler"))'
62
+ - set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
63
+ - ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exist?(File.join(Gem.dir, "cache", "bundler"))'
54
64
  - bundle install --jobs 3 --retry 3
55
65
  - net user
56
66
  - net localgroup
@@ -127,7 +127,7 @@ describe port(80) do
127
127
  end
128
128
  EOF
129
129
 
130
- if File.exists? "spec/#{@hostname}/sample_spec.rb"
130
+ if File.exist? "spec/#{@hostname}/sample_spec.rb"
131
131
  old_content = File.read("spec/#{@hostname}/sample_spec.rb")
132
132
  if old_content != content
133
133
  $stderr.puts "!! spec/#{@hostname}/sample_spec.rb already exists and differs from template"
@@ -141,7 +141,7 @@ EOF
141
141
  end
142
142
 
143
143
  def self.safe_mkdir(dir)
144
- if File.exists? dir
144
+ if File.exist? dir
145
145
  unless File.directory? dir
146
146
  $stderr.puts "!! #{dir} already exists and is not a directory"
147
147
  end
@@ -153,7 +153,7 @@ EOF
153
153
 
154
154
  def self.safe_create_spec_helper
155
155
  content = ERB.new(spec_helper_template, nil, '-').result(binding)
156
- if File.exists? 'spec/spec_helper.rb'
156
+ if File.exist? 'spec/spec_helper.rb'
157
157
  old_content = File.read('spec/spec_helper.rb')
158
158
  if old_content != content
159
159
  $stderr.puts "!! spec/spec_helper.rb already exists and differs from template"
@@ -196,7 +196,7 @@ namespace :spec do
196
196
  end
197
197
  end
198
198
  EOF
199
- if File.exists? 'Rakefile'
199
+ if File.exist? 'Rakefile'
200
200
  old_content = File.read('Rakefile')
201
201
  if old_content != content
202
202
  $stderr.puts '!! Rakefile already exists and differs from template'
@@ -212,7 +212,7 @@ end
212
212
  def self.find_vagrantfile
213
213
  Pathname.new(Dir.pwd).ascend do |dir|
214
214
  path = File.expand_path('Vagrantfile', dir)
215
- return path if File.exists?(path)
215
+ return path if File.exist?(path)
216
216
  end
217
217
  nil
218
218
  end
@@ -308,8 +308,21 @@ user = <username>
308
308
  pass = <password>
309
309
  endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
310
310
 
311
- winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
312
- winrm.set_timeout 300 # 5 minutes max timeout for any operation
311
+ if Gem::Version.new(WinRM::VERSION) < Gem::Version.new('2')
312
+ winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
313
+ winrm.set_timeout 300 # 5 minutes max timeout for any operation
314
+ else
315
+ opts = {
316
+ user: user,
317
+ password: pass,
318
+ endpoint: endpoint,
319
+ operation_timeout: 300,
320
+ no_ssl_peer_verification: false,
321
+ }
322
+
323
+ winrm = ::WinRM::Connection.new(opts)
324
+ end
325
+
313
326
  Specinfra.configuration.winrm = winrm
314
327
  <% end -%>
315
328
  EOF
@@ -321,7 +334,7 @@ EOF
321
334
  --color
322
335
  --format documentation
323
336
  EOF
324
- if File.exists? '.rspec'
337
+ if File.exist? '.rspec'
325
338
  old_content = File.read('.rspec')
326
339
  if old_content != content
327
340
  $stderr.puts '!! .rspec already exists and differs from template'
@@ -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
@@ -121,7 +121,13 @@ module Serverspec::Type
121
121
  end
122
122
 
123
123
  def content_as_yaml
124
- @content_as_yaml = YAML.load(content) if @content_as_yaml.nil?
124
+ if @content_as_yaml.nil?
125
+ @content_as_yaml = if YAML.respond_to?(:unsafe_load)
126
+ YAML.unsafe_load(content)
127
+ else
128
+ YAML.load(content)
129
+ end
130
+ end
125
131
  @content_as_yaml
126
132
  end
127
133
 
@@ -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
@@ -1,7 +1,8 @@
1
1
  module Serverspec::Type
2
2
  class Service < Base
3
3
  def enabled?(level, under=nil)
4
- check_method = "check_service_is_enabled" + (under ? "_#{under}" : '')
4
+ under = under ? "_under_#{under.gsub(/^under_/, '')}" : ''
5
+ check_method = "check_service_is_enabled#{under}"
5
6
 
6
7
  if level
7
8
  @runner.send(check_method.to_sym, @name, level)
@@ -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.3"
2
+ VERSION = "2.42.2"
3
3
  end
data/serverspec.gemspec CHANGED
@@ -22,7 +22,11 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "rspec-its"
23
23
  spec.add_runtime_dependency "multi_json"
24
24
  spec.add_runtime_dependency "specinfra", "~> 2.72"
25
- spec.add_development_dependency "bundler", "~> 1.3"
26
- spec.add_development_dependency("json", "~> 1.8") if RUBY_VERSION < "1.9"
27
- spec.add_development_dependency "rake", "~> 10.1.1"
25
+
26
+ if RUBY_VERSION < "1.9"
27
+ spec.add_development_dependency "json", "~> 1.8"
28
+ spec.add_development_dependency "rake", "~> 10.1.1"
29
+ else
30
+ spec.add_development_dependency "rake"
31
+ end
28
32
  end
@@ -369,18 +369,22 @@ describe file('example.yml') do
369
369
  let(:stdout) {<<EOF
370
370
  ---
371
371
  yaml:
372
- title: 'this is a yaml'
372
+ title: &anchor 'this is a yaml'
373
373
  array:
374
374
  -
375
375
  title: 'array 1'
376
376
  -
377
377
  title: 'array 2'
378
+ date: 2023-02-03
379
+ Reuse anchor: *anchor
378
380
  EOF
379
381
  }
380
382
 
381
383
  its(:content_as_yaml) { should include('yaml') }
382
384
  its(:content_as_yaml) { should include('yaml' => include('title' => 'this is a yaml')) }
383
385
  its(:content_as_yaml) { should include('yaml' => include('array' => include('title' => 'array 2'))) }
386
+ its(:content_as_yaml) { should include('yaml' => include('date' => Date.new(2023, 2, 3))) }
387
+ its(:content_as_yaml) { should include('yaml' => include('Reuse anchor' => 'this is a yaml')) }
384
388
  end
385
389
 
386
390
 
@@ -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.3
4
+ version: 2.42.2
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: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -66,34 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.72'
69
- - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.3'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 10.1.1
75
+ version: '0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: 10.1.1
82
+ version: '0'
97
83
  description: RSpec tests for your servers configured by Puppet, Chef, Itamae or anything
98
84
  else
99
85
  email:
@@ -103,6 +89,7 @@ executables:
103
89
  extensions: []
104
90
  extra_rdoc_files: []
105
91
  files:
92
+ - ".github/stale.yml"
106
93
  - ".gitignore"
107
94
  - ".gitmodules"
108
95
  - ".travis.yml"
@@ -319,7 +306,7 @@ homepage: http://serverspec.org/
319
306
  licenses:
320
307
  - MIT
321
308
  metadata: {}
322
- post_install_message:
309
+ post_install_message:
323
310
  rdoc_options: []
324
311
  require_paths:
325
312
  - lib
@@ -334,9 +321,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
321
  - !ruby/object:Gem::Version
335
322
  version: '0'
336
323
  requirements: []
337
- rubyforge_project:
338
- rubygems_version: 2.2.2
339
- signing_key:
324
+ rubyforge_project:
325
+ rubygems_version: 2.5.1
326
+ signing_key:
340
327
  specification_version: 4
341
328
  summary: RSpec tests for your servers configured by Puppet, Chef, Itamae or anything
342
329
  else