inspec 1.44.8 → 1.45.9

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
  SHA1:
3
- metadata.gz: '0586114d59157e09b9b4aa313cf7ec2e3db9a720'
4
- data.tar.gz: cb26ac2fb7d6d46606b4e84b9be339da1f4b5d07
3
+ metadata.gz: 1a9abff18ab1cdd996b01299cb2c0e0ab2bdbaab
4
+ data.tar.gz: 24deaa54689c34fd8f7813e10828a74d54583e79
5
5
  SHA512:
6
- metadata.gz: b6b466fd7877af420af8fad49925b94e51b09e3ed07ea9bc21ebc9e211d67966d73e27c6461a49bd48be9afbfa3b7a7f9647d40d5b4f2ecdb323bde76ad6b990
7
- data.tar.gz: 652504e305a7b8a145c5d17120313f107c2e3742668491431a73767b43463f8d71b29517bc71b330863929cee4f5668c498194c780b66d993c750ce08113191c
6
+ metadata.gz: c70d6d686d8bc62602837812f291a1bb1b05805cad90bf2fe22d168809cd3d427ff31ac4f57d5471be5f334c8daae22fab0e9a646e311c9152b88c9f09fe4d06
7
+ data.tar.gz: 48c1b044e2d6082bfe89d1babe2df372625f7a970468882c10180b855da5625eeec81eab3c4096abbe1690cf78def4f1b4960ea871a8c1ef9da69eee3c5c3c73
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  AllCops:
3
+ TargetRubyVersion: 2.3
3
4
  Exclude:
4
5
  - Gemfile
5
6
  - Rakefile
@@ -13,6 +14,8 @@ AlignParameters:
13
14
  Enabled: true
14
15
  Encoding:
15
16
  Enabled: true
17
+ FrozenStringLiteralComment:
18
+ Enabled: false
16
19
  HashSyntax:
17
20
  Enabled: true
18
21
  LineLength:
@@ -1,41 +1,60 @@
1
1
  # Change Log
2
2
  <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
3
- <!-- latest_release 1.44.8 -->
4
- ## [v1.44.8](https://github.com/chef/inspec/tree/v1.44.8) (2017-11-09)
3
+ <!-- latest_release 1.45.9 -->
4
+ ## [v1.45.9](https://github.com/chef/inspec/tree/v1.45.9) (2017-11-16)
5
5
 
6
6
  #### Enhancements
7
- - Issue warning during check if profile name contains slash [#2231](https://github.com/chef/inspec/pull/2231) ([clintoncwolfe](https://github.com/clintoncwolfe))
7
+ - http resource: Add basic param handling to remote HTTP worker [#2286](https://github.com/chef/inspec/pull/2286) ([schisamo](https://github.com/schisamo))
8
8
  <!-- latest_release -->
9
9
 
10
- <!-- release_rollup since=1.43.8 -->
11
- ### Changes since 1.43.8 release
10
+ <!-- release_rollup since=1.44.8 -->
11
+ ### Changes since 1.44.8 release
12
12
 
13
13
  #### Enhancements
14
- - Issue warning during check if profile name contains slash [#2231](https://github.com/chef/inspec/pull/2231) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 1.44.8 -->
15
- - http resource: supply max-time option using read_timeout and open_timeout [#2289](https://github.com/chef/inspec/pull/2289) ([bdellegrazie](https://github.com/bdellegrazie)) <!-- 1.44.5 -->
16
- - allow users to specify user/namespace when fetching profiles from Chef Automate [#2275](https://github.com/chef/inspec/pull/2275) ([arlimus](https://github.com/arlimus)) <!-- 1.44.1 -->
17
- - Add non-halting exception support to resources [#2235](https://github.com/chef/inspec/pull/2235) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.44.0 -->
14
+ - http resource: Add basic param handling to remote HTTP worker [#2286](https://github.com/chef/inspec/pull/2286) ([schisamo](https://github.com/schisamo)) <!-- 1.45.9 -->
15
+ - Correctly format skip exceptions in formatters [#2307](https://github.com/chef/inspec/pull/2307) ([adamleff](https://github.com/adamleff)) <!-- 1.45.4 -->
18
16
 
19
17
  #### Merged Pull Requests
20
- - Eliminate deprecation warnings on resource skipped messages [#2296](https://github.com/chef/inspec/pull/2296) ([adamleff](https://github.com/adamleff)) <!-- 1.44.6 -->
21
- - Use Ruby 2.4.2 in the Omnibus InSpec packages [#2294](https://github.com/chef/inspec/pull/2294) ([adamleff](https://github.com/adamleff)) <!-- 1.44.4 -->
22
- - Switch to tomlrb for TOML parsing [#2295](https://github.com/chef/inspec/pull/2295) ([adamleff](https://github.com/adamleff)) <!-- 1.44.2 -->
23
- - Pin RubyGems to 2.6.14 [#2287](https://github.com/chef/inspec/pull/2287) ([adamleff](https://github.com/adamleff)) <!-- 1.43.10 -->
18
+ - Update Rubocop to TargetRubyVersion 2.3 [#2311](https://github.com/chef/inspec/pull/2311) ([adamleff](https://github.com/adamleff)) <!-- 1.45.8 -->
19
+ - Require Ruby 2.3 and later [#2293](https://github.com/chef/inspec/pull/2293) ([adamleff](https://github.com/adamleff)) <!-- 1.45.7 -->
20
+ - Fix gid filtering for etc_group resource [#2297](https://github.com/chef/inspec/pull/2297) ([eramoto](https://github.com/eramoto)) <!-- 1.45.3 -->
21
+ - Habitat build works for all versions, eliminates rake [#2301](https://github.com/chef/inspec/pull/2301) ([adamleff](https://github.com/adamleff)) <!-- 1.45.2 -->
22
+ - Bumping train to 0.29.1 [#2306](https://github.com/chef/inspec/pull/2306) ([adamleff](https://github.com/adamleff)) <!-- 1.45.0 -->
24
23
 
25
24
  #### Bug Fixes
26
- - Properly compare profile version strings as SemVer [#2280](https://github.com/chef/inspec/pull/2280) ([adamleff](https://github.com/adamleff)) <!-- 1.44.7 -->
27
- - nginx resource: support quoted identifiers [#2292](https://github.com/chef/inspec/pull/2292) ([adamleff](https://github.com/adamleff)) <!-- 1.44.3 -->
28
- - http resource: use proper syntax in `curl` header option [#2285](https://github.com/chef/inspec/pull/2285) ([schisamo](https://github.com/schisamo)) <!-- 1.43.9 -->
25
+ - xinetd_conf resource: fix false positives when config file or directory doesn&#39;t exist [#2302](https://github.com/chef/inspec/pull/2302) ([eramoto](https://github.com/eramoto)) <!-- 1.45.6 -->
26
+ - oracledb_session resource: fix credential passing to sql/sqlplus [#2308](https://github.com/chef/inspec/pull/2308) ([bratdim](https://github.com/bratdim)) <!-- 1.45.5 -->
27
+ - Fix classname in JUnit formatter [#2283](https://github.com/chef/inspec/pull/2283) ([adamleff](https://github.com/adamleff)) <!-- 1.45.1 -->
28
+ - port resource: handle ss output from older iproute package [#2305](https://github.com/chef/inspec/pull/2305) ([Wing924](https://github.com/Wing924)) <!-- 1.44.9 -->
29
29
  <!-- release_rollup -->
30
30
 
31
31
  <!-- latest_stable_release -->
32
+ ## [v1.44.8](https://github.com/chef/inspec/tree/v1.44.8) (2017-11-09)
33
+
34
+ #### Enhancements
35
+ - Add non-halting exception support to resources [#2235](https://github.com/chef/inspec/pull/2235) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
36
+ - allow users to specify user/namespace when fetching profiles from Chef Automate [#2275](https://github.com/chef/inspec/pull/2275) ([arlimus](https://github.com/arlimus))
37
+ - http resource: supply max-time option using read_timeout and open_timeout [#2289](https://github.com/chef/inspec/pull/2289) ([bdellegrazie](https://github.com/bdellegrazie))
38
+ - Issue warning during check if profile name contains slash [#2231](https://github.com/chef/inspec/pull/2231) ([clintoncwolfe](https://github.com/clintoncwolfe))
39
+
40
+ #### Bug Fixes
41
+ - http resource: use proper syntax in `curl` header option [#2285](https://github.com/chef/inspec/pull/2285) ([schisamo](https://github.com/schisamo))
42
+ - nginx resource: support quoted identifiers [#2292](https://github.com/chef/inspec/pull/2292) ([adamleff](https://github.com/adamleff))
43
+ - Properly compare profile version strings as SemVer [#2280](https://github.com/chef/inspec/pull/2280) ([adamleff](https://github.com/adamleff))
44
+
45
+ #### Merged Pull Requests
46
+ - Pin RubyGems to 2.6.14 [#2287](https://github.com/chef/inspec/pull/2287) ([adamleff](https://github.com/adamleff))
47
+ - Switch to tomlrb for TOML parsing [#2295](https://github.com/chef/inspec/pull/2295) ([adamleff](https://github.com/adamleff))
48
+ - Use Ruby 2.4.2 in the Omnibus InSpec packages [#2294](https://github.com/chef/inspec/pull/2294) ([adamleff](https://github.com/adamleff))
49
+ - Eliminate deprecation warnings on resource skipped messages [#2296](https://github.com/chef/inspec/pull/2296) ([adamleff](https://github.com/adamleff))
50
+ <!-- latest_stable_release -->
51
+
32
52
  ## [v1.43.8](https://github.com/chef/inspec/tree/v1.43.8) (2017-11-02)
33
53
 
34
54
  #### Bug Fixes
35
55
  - inspec compliance login: Ensure supplied server has a proper URI scheme [#2268](https://github.com/chef/inspec/pull/2268) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
36
56
  - mount resource: fix for Device-/Sharenames and Mountpoints including … [#2257](https://github.com/chef/inspec/pull/2257) ([mgrobelin](https://github.com/mgrobelin))
37
57
  - service resource: properly search for SysV Init S files [#2274](https://github.com/chef/inspec/pull/2274) ([Wing924](https://github.com/Wing924))
38
- <!-- latest_stable_release -->
39
58
 
40
59
  ## [v1.43.5](https://github.com/chef/inspec/tree/v1.43.5) (2017-10-26)
41
60
 
data/Rakefile CHANGED
@@ -150,23 +150,6 @@ task :release_docker do
150
150
  sh('sh', '-c', cmd)
151
151
  end
152
152
 
153
- desc 'Release a new Habitat package'
154
- task :release_habitat do
155
- version = Inspec::VERSION
156
- ENV['HAB_ORIGIN'] = "chef"
157
- if Dir.exist?("./results") then
158
- raise "Please remove the ./results directory"
159
- end
160
- if ! ENV.has_key?("HAB_AUTH_TOKEN") then
161
- raise "Please set the HAB_AUTH_TOKEN environment variable"
162
- end
163
- cmd = "echo #{version} > ./habitat/VERSION && "\
164
- "hab pkg build . && " \
165
- "hab pkg upload ./results/*.hart --channel stable"
166
- puts "--> #{cmd}"
167
- sh('sh', '-c', cmd)
168
- end
169
-
170
153
  desc 'Release the website [deprecated]'
171
154
  task :www do
172
155
  puts 'The Rake tasks for releasing the website are now in the www/ directory.'
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
24
24
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.required_ruby_version = '>= 2.1'
27
+ spec.required_ruby_version = '>= 2.3'
28
28
 
29
- spec.add_dependency 'train', '~> 0.28'
29
+ spec.add_dependency 'train', '~> 0.29', '>= 0.29.1'
30
30
  spec.add_dependency 'thor', '~> 0.19'
31
31
  spec.add_dependency 'json', '>= 1.8', '< 3.0'
32
32
  spec.add_dependency 'rainbow', '~> 2'
@@ -79,17 +79,17 @@ module Artifact
79
79
  KEY_BITS=2048
80
80
  KEY_ALG=OpenSSL::PKey::RSA
81
81
 
82
- INSPEC_PROFILE_VERSION_1='INSPEC-PROFILE-1'.freeze
83
- INSPEC_REPORT_VERSION_1='INSPEC-REPORT-1'.freeze
82
+ INSPEC_PROFILE_VERSION_1='INSPEC-PROFILE-1'
83
+ INSPEC_REPORT_VERSION_1='INSPEC-REPORT-1'
84
84
 
85
85
  ARTIFACT_DIGEST=OpenSSL::Digest::SHA512
86
- ARTIFACT_DIGEST_NAME='SHA512'.freeze
86
+ ARTIFACT_DIGEST_NAME='SHA512'
87
87
 
88
88
  VALID_PROFILE_VERSIONS=Set.new [INSPEC_PROFILE_VERSION_1]
89
89
  VALID_PROFILE_DIGESTS=Set.new [ARTIFACT_DIGEST_NAME]
90
90
 
91
- SIGNED_PROFILE_SUFFIX='iaf'.freeze
92
- SIGNED_REPORT_SUFFIX='iar'.freeze
91
+ SIGNED_PROFILE_SUFFIX='iaf'
92
+ SIGNED_REPORT_SUFFIX='iar'
93
93
 
94
94
  # rubocop:disable Metrics/ClassLength
95
95
  class CLI < Inspec::BaseCLI
@@ -8,7 +8,7 @@ require 'addressable/uri'
8
8
 
9
9
  module Supermarket
10
10
  class API
11
- SUPERMARKET_URL = 'https://supermarket.chef.io'.freeze
11
+ SUPERMARKET_URL = 'https://supermarket.chef.io'
12
12
 
13
13
  # displays a list of profiles
14
14
  def self.profiles(supermarket_url = SUPERMARKET_URL)
@@ -189,7 +189,7 @@ module Inspec
189
189
  logger.warn(
190
190
  "Do not use deprecated `supports: #{x}` syntax. Instead use:\n"\
191
191
  "supports:\n - os-family: #{x}\n\n")
192
- { :'os-family' => x }
192
+ { :'os-family' => x } # rubocop:disable Style/HashSyntax
193
193
  end
194
194
  end
195
195
 
@@ -203,7 +203,7 @@ module Inspec
203
203
  logger.warn(
204
204
  "Do not use deprecated `supports: #{x}` syntax. Instead use:\n"\
205
205
  "supports:\n - os-family: #{x}\n\n")
206
- [{ :'os-family' => x }]
206
+ [{ :'os-family' => x }] # rubocop:disable Style/HashSyntax
207
207
  end
208
208
  end
209
209
 
@@ -62,6 +62,10 @@ class InspecRspecMiniJson < RSpec::Core::Formatters::JsonFormatter
62
62
  next if e.is_a? RSpec::Expectations::ExpectationNotMetError
63
63
  hash[:exception] = e.class.name
64
64
  hash[:backtrace] = e.backtrace
65
+
66
+ # if the exception indicates the resource author wants to skip the test,
67
+ # we update the test status here.
68
+ hash[:status] = 'skipped' if e.is_a?(Inspec::Exceptions::ResourceSkipped)
65
69
  end
66
70
  end
67
71
  end
@@ -571,7 +575,8 @@ class InspecRspecCli < InspecRspecJson # rubocop:disable Metrics/ClassLength
571
575
  end
572
576
 
573
577
  def print_result(result)
574
- test_status = result[:status_type]
578
+ test_skipped = result[:status] == 'skipped'
579
+ test_status = test_skipped ? 'skipped' : result[:status_type]
575
580
  indicator = INDICATORS[result[:status]]
576
581
  indicator = INDICATORS['empty'] if indicator.nil?
577
582
  if result[:message]
@@ -821,7 +826,9 @@ class InspecRspecCli < InspecRspecJson # rubocop:disable Metrics/ClassLength
821
826
  end
822
827
 
823
828
  def update_summary(example)
824
- example_status = STATUS_TYPES[example[:status_type]]
829
+ test_skipped = example[:status] == 'skipped'
830
+ status_type = test_skipped ? 'skipped' : example[:status_type]
831
+ example_status = STATUS_TYPES[status_type]
825
832
  @summary_status = example_status if example_status > @summary_status
826
833
  fails.push(example) if example_status > 0
827
834
  passes.push(example) if example_status == STATUS_TYPES['passed']
@@ -874,8 +881,9 @@ class InspecRspecJUnit < InspecRspecJson
874
881
  private
875
882
 
876
883
  def build_profile_xml(profile)
884
+ profile_name = profile[:name]
877
885
  profile_xml = REXML::Element.new('testsuite')
878
- profile_xml.add_attribute('name', profile[:name])
886
+ profile_xml.add_attribute('name', profile_name)
879
887
  profile_xml.add_attribute('tests', count_profile_tests(profile))
880
888
  profile_xml.add_attribute('failed', count_profile_failed_tests(profile))
881
889
 
@@ -883,17 +891,24 @@ class InspecRspecJUnit < InspecRspecJson
883
891
  next if control[:results].nil?
884
892
 
885
893
  control[:results].each do |result|
886
- profile_xml.add(build_result_xml(control, result))
894
+ profile_xml.add(build_result_xml(profile_name, control, result))
887
895
  end
888
896
  end
889
897
 
890
898
  profile_xml
891
899
  end
892
900
 
893
- def build_result_xml(control, result)
901
+ def build_result_xml(profile_name, control, result)
894
902
  result_xml = REXML::Element.new('testcase')
895
903
  result_xml.add_attribute('name', result[:code_desc])
896
- result_xml.add_attribute('class', control[:title].nil? ? 'Anonymous' : control[:id])
904
+ # if there is no control title, we are likely receiving test results from a
905
+ # "naked" test (a test not located within a control block). Therefore, rather
906
+ # than outputting the auto-generated ID, i.e.
907
+ #
908
+ # "(generated from test_spec.rb:1 de0ce10e4bbbd4d0ff7a65f4234de8c1)")
909
+ #
910
+ # ... we'll output "Anonymous" instead.
911
+ result_xml.add_attribute('classname', control[:title].nil? ? "#{profile_name}.Anonymous" : "#{profile_name}.#{control[:id]}")
897
912
  result_xml.add_attribute('time', result[:run_time])
898
913
 
899
914
  if result[:status] == 'failed'
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '1.44.8'.freeze
7
+ VERSION = '1.45.9'
8
8
  end
@@ -85,7 +85,7 @@ module Inspec::Resources
85
85
  conditions.each do |k, v|
86
86
  idx = fields[k.to_sym]
87
87
  next if idx.nil?
88
- res = res.select { |x| x[idx] == v.to_s }
88
+ res = res.select { |x| x[idx].to_s == v.to_s }
89
89
  end
90
90
 
91
91
  EtcGroupView.new(self, res)
@@ -165,7 +165,7 @@ module Inspec::Resources
165
165
 
166
166
  def body
167
167
  run_curl
168
- @body
168
+ @body&.strip
169
169
  end
170
170
 
171
171
  def response_headers
@@ -202,7 +202,7 @@ module Inspec::Resources
202
202
  end
203
203
  end
204
204
 
205
- def curl_command
205
+ def curl_command # rubocop:disable Metrics/AbcSize
206
206
  cmd = ["curl -i -X #{http_method}"]
207
207
  cmd << "--connect-timeout #{open_timeout}"
208
208
  cmd << "--max-time #{open_timeout+read_timeout}"
@@ -214,7 +214,11 @@ module Inspec::Resources
214
214
  cmd << "-H '#{k}: #{v}'"
215
215
  end
216
216
 
217
- cmd << "'#{url}'"
217
+ if params.nil?
218
+ cmd << "'#{url}'"
219
+ else
220
+ cmd << "'#{url}?#{params.map { |e| e.join('=') }.join('&')}'"
221
+ end
218
222
 
219
223
  cmd.join(' ')
220
224
  end
@@ -60,7 +60,9 @@ module Inspec::Resources
60
60
  p = :parse_html_result
61
61
  end
62
62
 
63
- command = "echo \"#{opts}\n#{verify_query(escaped_query)}\nEXIT\" | #{bin} -s #{@user}/#{@password}@//#{@host}:#{@port}/#{@service}"
63
+ query = verify_query(escaped_query)
64
+ query += ';' unless query.end_with?(';')
65
+ command = %{echo "#{opts}\n#{query}\nEXIT" | #{bin} "#{@user}"/"#{@password}"@#{@host}:#{@port}/#{@service}}
64
66
  cmd = inspec.command(command)
65
67
 
66
68
  out = cmd.stdout + "\n" + cmd.stderr
@@ -504,15 +504,42 @@ module Inspec::Resources
504
504
  }
505
505
  end
506
506
 
507
+ def tokenize_ss_line(line)
508
+ # iproute-2.6.32-54.el6 output:
509
+ # Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
510
+ # udp UNCONN 0 0 *:111 *:* users:(("rpcbind",1123,6)) ino=8680 sk=ffff8801390cf7c0
511
+ # tcp LISTEN 0 128 *:22 *:* users:(("sshd",3965,3)) ino:11604 sk:ffff88013a3b5800
512
+ #
513
+ # iproute-2.6.32-20.el6 output:
514
+ # Netid Recv-Q Send-Q Local Address:Port Peer Address:Port
515
+ # udp 0 0 *:111 *:* users:(("rpcbind",1123,6)) ino=8680 sk=ffff8801390cf7c0
516
+ # tcp 0 128 *:22 *:* users:(("sshd",3965,3)) ino:11604 sk:ffff88013a3b5800
517
+ tokens = line.split(/\s+/, 7)
518
+ if tokens[1] =~ /^\d+$/ # iproute-2.6.32-20
519
+ {
520
+ netid: tokens[0],
521
+ local_addr: tokens[3],
522
+ process_info: tokens[5],
523
+ }
524
+ else # iproute-2.6.32-54
525
+ {
526
+ netid: tokens[0],
527
+ local_addr: tokens[4],
528
+ process_info: tokens[6],
529
+ }
530
+ end
531
+ end
532
+
507
533
  def parse_ss_line(line)
508
- parsed = line.split(/\s+/, 7)
534
+ # parsed = line.split(/\s+/, 7)
535
+ parsed = tokenize_ss_line(line)
509
536
 
510
537
  # ss only returns "tcp" and "udp" as the protocol. However, netstat would return
511
538
  # "tcp6" and "udp6" as necessary. In order to maintain backward compatibility, we
512
539
  # will manually modify the protocol value if the line we're parsing is an IPv6
513
540
  # entry.
514
- process_info = parsed[6]
515
- protocol = parsed[0]
541
+ process_info = parsed[:process_info]
542
+ protocol = parsed[:netid]
516
543
  protocol += '6' if process_info.include?('v6only:1')
517
544
  return nil unless ALLOWED_PROTOCOLS.include?(protocol)
518
545
 
@@ -523,7 +550,7 @@ module Inspec::Resources
523
550
  # 10.0.2.15:1234
524
551
  # ::ffff:10.0.2.15:9300
525
552
  # fe80::a00:27ff:fe32:ed09%enp0s3:9200
526
- parsed_net_address = parsed[4].match(/(\S+):(\*|\d+)$/)
553
+ parsed_net_address = parsed[:local_addr].match(/(\S+):(\*|\d+)$/)
527
554
  return nil if parsed_net_address.nil?
528
555
  host = parsed_net_address[1]
529
556
  port = parsed_net_address[2]
@@ -556,7 +583,7 @@ module Inspec::Resources
556
583
  # remove the "users:((" and "))" parts
557
584
  # input: users:((\"nginx\",pid=583,fd=8),(\"nginx\",pid=582,fd=8),(\"nginx\",pid=580,fd=8),(\"nginx\",pid=579,fd=8))
558
585
  # res: \"nginx\",pid=583,fd=8),(\"nginx\",pid=582,fd=8),(\"nginx\",pid=580,fd=8),(\"nginx\",pid=579,fd=8
559
- process_list_match = parsed[6].match(/users:\(\((.+)\)\)/)
586
+ process_list_match = parsed[:process_info].match(/users:\(\((.+)\)\)/)
560
587
  if process_list_match
561
588
  # list entires are seperated by "," the braces can also be removed
562
589
  # input: \"nginx\",pid=583,fd=8),(\"nginx\",pid=582,fd=8),(\"nginx\",pid=580,fd=8),(\"nginx\",pid=579,fd=8
@@ -53,15 +53,14 @@ module Inspec::Resources
53
53
  return @contents[path] if @contents.key?(path)
54
54
  file = inspec.file(path)
55
55
  if !file.file?
56
- return skip_resource "Can't find file \"#{path}\""
56
+ raise Inspec::Exceptions::ResourceSkipped, "Can't find file: #{path}"
57
57
  end
58
58
 
59
- @contents[path] = file.content
60
- if @contents[path].nil? || @contents[path].empty?
61
- return skip_resource "Can't read file \"#{path}\""
59
+ if file.content.nil? || file.content.empty?
60
+ raise Inspec::Exceptions::ResourceSkipped, "Can't read file: #{path}"
62
61
  end
63
62
 
64
- @contents[path]
63
+ @contents[path] = file.content
65
64
  end
66
65
 
67
66
  def read_params
@@ -69,7 +68,6 @@ module Inspec::Resources
69
68
  flat_params = parse_xinetd(read_content)
70
69
  # we need to map service data in order to use it with filtertable
71
70
  params = { 'services' => {} }
72
-
73
71
  # map services that were defined and map it to the service hash
74
72
  flat_params.each do |k, v|
75
73
  name = k[/^service (.+)$/, 1]
@@ -217,7 +217,7 @@ module XinetdParser
217
217
  return [] if dir.nil?
218
218
 
219
219
  unless inspec.file(dir).directory?
220
- return skip_resource "Cannot read folder in #{dir}"
220
+ raise Inspec::Exceptions::ResourceSkipped, "Can't find folder: #{dir}"
221
221
  end
222
222
 
223
223
  files = inspec.command("find #{dir} -type f").stdout.split("\n")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.44.8
4
+ version: 1.45.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-09 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.28'
19
+ version: '0.29'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.29.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '0.28'
29
+ version: '0.29'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.29.1
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: thor
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -690,7 +696,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
690
696
  requirements:
691
697
  - - ">="
692
698
  - !ruby/object:Gem::Version
693
- version: '2.1'
699
+ version: '2.3'
694
700
  required_rubygems_version: !ruby/object:Gem::Requirement
695
701
  requirements:
696
702
  - - ">="