inspec-core 5.22.40 → 5.22.50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a95805ac2a4faab83d1826792a5d838caa5f1808fcc884e061cf3f7070ab6ef2
4
- data.tar.gz: 984dfca55efec04f1e9b98ddfebf5be636b96a91c7fe7dc97f9ffb9789c60af3
3
+ metadata.gz: bf0d707c247850a684a024680d641da787207608e7601e617023b29c299d1d2f
4
+ data.tar.gz: 684b3be8f6b45f7ffa770670f3eb9e281253c3e2c46f47c8d0e50e2d2090d564
5
5
  SHA512:
6
- metadata.gz: fb6e20f346e0e5ab27878931b1396c10a633b99767472774299d92fce3ae2ccf01399cb100e5ae4566456039a3d814ac4148670da65b41563e72139d29551ed7
7
- data.tar.gz: 0c9c665c3afb6d90121bf40ac00736a900955e0ea5955af58f7e56378d18eecfd7560f40e2cce049afd7156ecb495c77b1c58765c0e69f82bfd03e976c2f367f
6
+ metadata.gz: 701450c7309e4d2d637b631f2e409f4d16dea4468771ce5c3a1aa9bf1a3fd75b9c25defde7d19ed21c005e8511134ea624cde373f99d448e79c90385a73da61f
7
+ data.tar.gz: 3afa092af7a5c77918ec4a6cf7d1904b649cb67e988025e9abbc8011cd13fd5124942b540efdcdafbcb83549a3f5627e85e7dc10e349097a2988803936aac58d
data/Gemfile CHANGED
@@ -27,25 +27,20 @@ group :omnibus do
27
27
  end
28
28
 
29
29
  group :test do
30
- gem "chefstyle", "~> 2.2.2"
31
- gem "concurrent-ruby", "~> 1.0"
32
- gem "json_schemer", ">= 0.2.1", "< 2.0.1"
30
+ gem "chefstyle"
31
+ gem "concurrent-ruby"
32
+ gem "json_schemer"
33
33
  gem "m"
34
34
  gem "minitest-sprint", "~> 1.0"
35
35
  gem "minitest", "5.15.0"
36
- gem "mocha", "~> 2.1"
37
- gem "nokogiri", "~> 1.9"
36
+ gem "mocha"
37
+ gem "nokogiri"
38
38
  gem "pry-byebug"
39
- gem "pry", "~> 0.10"
40
- gem "rake", ">= 10"
41
- gem "simplecov", "~> 0.21"
39
+ gem "pry"
40
+ gem "rake"
41
+ gem "simplecov"
42
42
  gem "simplecov_json_formatter"
43
- gem "webmock", "~> 3.0"
44
-
45
- if Gem.ruby_version >= Gem::Version.new("3.0.0")
46
- # html-proofer has a dep on io-event, which is ruby-3 only
47
- gem "html-proofer", "~> 3.19.4", platforms: :ruby # do not attempt to run proofer on windows. Pinned to 3.19.4 as test is breaking in updated versions.
48
- end
43
+ gem "webmock"
49
44
  end
50
45
 
51
46
  group :deploy do
data/inspec-core.gemspec CHANGED
@@ -47,5 +47,11 @@ Gem::Specification.new do |spec|
47
47
  spec.add_dependency "semverse", "~> 3.0"
48
48
  spec.add_dependency "multipart-post", "~> 2.0"
49
49
 
50
+ # cookstyle support for inspec check
51
+ # This was initially included in 'inspec.gemspec' to keep 'chef-client' lightweight.
52
+ # However, it has been moved to 'inspec-core.gemspec' due to a dependency on the 'ast' gem,
53
+ # which was causing a LoadError ('cannot load such file -- ast') for users/applications using 'inspec-core'.
54
+ spec.add_dependency "cookstyle"
55
+
50
56
  spec.add_dependency "train-core", "~> 3.10"
51
57
  end
@@ -93,7 +93,7 @@ module Inspec::Fetcher
93
93
  end
94
94
 
95
95
  if transformed_target
96
- Inspec::Log.warn("URL target #{target} transformed to #{transformed_target}. Consider using the git fetcher")
96
+ Inspec::Log.debug("URL target #{target} transformed to #{transformed_target}. Consider using the git fetcher")
97
97
  transformed_target
98
98
  else
99
99
  target
@@ -133,12 +133,14 @@ module Inspec::Fetcher
133
133
  class << self
134
134
  def default_ref(match_data, repo_url)
135
135
  remote_url = "#{repo_url}/#{match_data[:user]}/#{match_data[:repo]}.git"
136
- command_string = "git remote show #{remote_url}"
136
+ command_string = "git ls-remote #{remote_url} HEAD"
137
137
  cmd = shellout(command_string)
138
138
  unless cmd.exitstatus == 0
139
139
  raise(Inspec::FetcherFailure, "Profile git dependency failed with default reference - #{remote_url} - error running '#{command_string}': #{cmd.stderr}")
140
140
  else
141
- ref = cmd.stdout.lines.detect { |l| l.include? "HEAD branch:" }&.split(":")&.last&.strip
141
+ # cmd.stdout of "git ls-remote #{remote_url} HEAD" looks like this:
142
+ # "457d14843ab7c1c3740169eb47cf129a6f417964\tHEAD\n"
143
+ ref = cmd.stdout.split("\t").first
142
144
  unless ref
143
145
  raise(Inspec::FetcherFailure, "Profile git dependency failed with default reference - #{remote_url} - error running '#{command_string}': NULL reference")
144
146
  end
@@ -223,7 +223,7 @@ module Inspec::Resources
223
223
  elsif cgroup_content =~ %r{^\d+:[^:]+:/(kubepods)/.+$}
224
224
  @virtualization_data[:system] = $1
225
225
  @virtualization_data[:role] = "guest"
226
- elsif /container=podman/.match?(file_read("/proc/1/environ"))
226
+ elsif /container=podman/.match?(inspec.file("/proc/1/environ").content)
227
227
  @virtualization_data[:system] = "podman"
228
228
  @virtualization_data[:role] = "guest"
229
229
  elsif lxc_version_exists? && cgroup_content =~ %r{\d:[^:]+:/$}
@@ -3,8 +3,7 @@ require "rubocop-ast"
3
3
  module Inspec
4
4
  class Profile
5
5
  class AstHelper
6
- class CollectorBase
7
- include Parser::AST::Processor::Mixin
6
+ class CollectorBase < Parser::AST::Processor
8
7
  include RuboCop::AST::Traversal
9
8
 
10
9
  attr_reader :memo
@@ -1,3 +1,3 @@
1
1
  module Inspec
2
- VERSION = "5.22.40".freeze
2
+ VERSION = "5.22.50".freeze
3
3
  end
@@ -299,9 +299,9 @@ RSpec::Matchers.define :cmp do |first_expected| # rubocop:disable Metrics/BlockL
299
299
  end
300
300
  end
301
301
 
302
- def format_actual(actual)
302
+ def format_actual(actual, negate = false)
303
303
  actual = "0%o" % actual if octal?(@expected) && !actual.nil?
304
- "\n%s\n got: %s\n\n(compared using `cmp` matcher)\n" % [format_expectation(false), actual]
304
+ "\n%s\n got: %s\n\n(compared using `cmp` matcher)\n" % [format_expectation(negate), actual]
305
305
  end
306
306
 
307
307
  def format_expectation(negate)
@@ -316,7 +316,7 @@ RSpec::Matchers.define :cmp do |first_expected| # rubocop:disable Metrics/BlockL
316
316
  end
317
317
 
318
318
  failure_message_when_negated do |actual|
319
- format_actual actual
319
+ format_actual actual, true
320
320
  end
321
321
 
322
322
  description do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.22.40
4
+ version: 5.22.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef InSpec Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
11
+ date: 2024-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-telemetry
@@ -364,6 +364,20 @@ dependencies:
364
364
  - - "~>"
365
365
  - !ruby/object:Gem::Version
366
366
  version: '2.0'
367
+ - !ruby/object:Gem::Dependency
368
+ name: cookstyle
369
+ requirement: !ruby/object:Gem::Requirement
370
+ requirements:
371
+ - - ">="
372
+ - !ruby/object:Gem::Version
373
+ version: '0'
374
+ type: :runtime
375
+ prerelease: false
376
+ version_requirements: !ruby/object:Gem::Requirement
377
+ requirements:
378
+ - - ">="
379
+ - !ruby/object:Gem::Version
380
+ version: '0'
367
381
  - !ruby/object:Gem::Dependency
368
382
  name: train-core
369
383
  requirement: !ruby/object:Gem::Requirement
@@ -854,7 +868,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
854
868
  - !ruby/object:Gem::Version
855
869
  version: '0'
856
870
  requirements: []
857
- rubygems_version: 3.1.4
871
+ rubygems_version: 3.2.3
858
872
  signing_key:
859
873
  specification_version: 4
860
874
  summary: Infrastructure and compliance testing. Core library.