inspec 0.27.0 → 0.27.1

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: 46a196f44aef946778a2c1551727b83826eaaede
4
- data.tar.gz: b351a6fddd347b9f951818ad3332270f3d399139
3
+ metadata.gz: 3b2dd34beaa375e165c66d9dfd6b45834464644c
4
+ data.tar.gz: a7fdabda77839fef8b33c810b96ad8e8abb35133
5
5
  SHA512:
6
- metadata.gz: 70da720dd36b4df18aca90293777b169ee25df1ebbb679500104e191ecdfa203d2136223e063e37c7ab0b5d5eed44029f65d2331bcd5d3eb825376c9e63f344f
7
- data.tar.gz: d09acee41a988495d4bec78a6a02409a89c89e8b527b5b3475ba622d2e6ab0da9751236bf1af7c6059c8e51a9193940b24cab6ef1f86cb66db80a174d5f4b8be
6
+ metadata.gz: 930e452dd58d92af6a2be666ae6fb820b7363efbb41864b702fdaa0d814d533da662c0c1b284daa5fc9c0bd6d0023eccb925df2f1b23b40130eea640b4c610b5
7
+ data.tar.gz: a09dbb59b25a8c2c0b09b509e471c0079f10064d9d3f9234fd9163a9acbc333378866789a5f31864fcfdd1623cc64ebce2c129c6fed7c158491ec5e9e51ae42e
data/CHANGELOG.md CHANGED
@@ -1,7 +1,24 @@
1
1
  # Change Log
2
2
 
3
- ## [0.27.0](https://github.com/chef/inspec/tree/0.27.0) (2016-07-10)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v0.26.0...0.27.0)
3
+ ## [0.27.1](https://github.com/chef/inspec/tree/0.27.1) (2016-07-15)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.27.0...0.27.1)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Inconsistent json format caused by inconsistent hash keys [\#827](https://github.com/chef/inspec/issues/827)
9
+
10
+ **Closed issues:**
11
+
12
+ - wrong path detection for postgres conf\_dir and conf\_path [\#823](https://github.com/chef/inspec/issues/823)
13
+
14
+ **Merged pull requests:**
15
+
16
+ - FIX: file\(hba\_config\_file\) test in documentation [\#830](https://github.com/chef/inspec/pull/830) ([atomic111](https://github.com/atomic111))
17
+ - Fix runner.rb key inconsistency [\#828](https://github.com/chef/inspec/pull/828) ([alexpop](https://github.com/alexpop))
18
+ - FIX \#823 wrong postgres path detection for conf\_dir and conf\_path [\#824](https://github.com/chef/inspec/pull/824) ([atomic111](https://github.com/atomic111))
19
+
20
+ ## [v0.27.0](https://github.com/chef/inspec/tree/v0.27.0) (2016-07-11)
21
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.26.0...v0.27.0)
5
22
 
6
23
  **Implemented enhancements:**
7
24
 
data/docs/resources.rst CHANGED
@@ -1239,9 +1239,9 @@ The following complete example tests the ``pg_hba.conf`` file in |postgresql| fo
1239
1239
  .. code-block:: bash
1240
1240
 
1241
1241
  describe file(hba_config_file) do
1242
- its('content') { should match /local\s.*?all\s.*?all\s.*?md5/ }
1243
- its('content') { should match %r{/host\s.*?all\s.*?all\s.*?127.0.0.1\/32\s.*?md5/} }
1244
- its('content') { should match %r{/host\s.*?all\s.*?all\s.*?::1\/128\s.*?md5/} }
1242
+ its('content') { should match(%r{local\s.*?all\s.*?all\s.*?md5}) }
1243
+ its('content') { should match(%r{host\s.*?all\s.*?all\s.*?127.0.0.1\/32\s.*?md5}) }
1244
+ its('content') { should match(%r{host\s.*?all\s.*?all\s.*?::1\/128\s.*?md5}) }
1245
1245
  end
1246
1246
 
1247
1247
  exist
data/lib/inspec/runner.rb CHANGED
@@ -109,7 +109,7 @@ module Inspec
109
109
  end
110
110
 
111
111
  def create_context(options = {})
112
- meta = options['metadata']
112
+ meta = options[:metadata]
113
113
  profile_id = nil
114
114
  profile_id = meta.params[:name] unless meta.nil?
115
115
  Inspec::ProfileContext.new(profile_id, @backend, @conf.merge(options))
@@ -123,7 +123,7 @@ module Inspec
123
123
  ctx.load_libraries(libs.map { |x| [x[:content], x[:ref], x[:line]] })
124
124
 
125
125
  # hand the context to the profile for further evaluation
126
- unless (profile = options['profile']).nil?
126
+ unless (profile = options[:profile]).nil?
127
127
  profile.runner_context = ctx
128
128
  end
129
129
 
@@ -3,5 +3,5 @@
3
3
  # author: Christoph Hartmann
4
4
 
5
5
  module Inspec
6
- VERSION = '0.27.0'.freeze
6
+ VERSION = '0.27.1'.freeze
7
7
  end
@@ -0,0 +1,13 @@
1
+ module Inspec::Resources
2
+ class Cache < Inspec.resource(1)
3
+ name 'cache'
4
+
5
+ def to_json
6
+ inspec.backend.to_json
7
+ end
8
+
9
+ def load_json(j)
10
+ inspec.backend.load_json(j)
11
+ end
12
+ end
13
+ end
@@ -24,6 +24,13 @@ module Inspec::Resources
24
24
  @conf_dir = '/var/lib/postgres/data'
25
25
  @conf_path = File.join @conf_dir, 'postgresql.conf'
26
26
 
27
+ when 'centos', 'redhat'
28
+ @service = 'postgresql'
29
+ @version = inspec.command('ls /var/lib/pgsql/').stdout.chomp
30
+ @data_dir = "/var/lib/pgsql/#{@version}/data"
31
+ @conf_dir = "/var/lib/pgsql/#{@version}/data"
32
+ @conf_path = File.join @conf_dir, 'postgresql.conf'
33
+
27
34
  else
28
35
  @service = 'postgresql'
29
36
  @data_dir = '/var/lib/postgresql'
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+ # author: Dominik Richter
3
+ # author: Christoph Hartmann
4
+
5
+ class HashMap
6
+ class << self
7
+ def [](hash, *keys)
8
+ return hash if keys.empty? || hash.nil?
9
+ key = keys.shift
10
+ if hash.is_a?(Array)
11
+ map = hash.map { |i| [i, key] }
12
+ else
13
+ map = hash[key]
14
+ end
15
+ [map, *keys]
16
+ rescue NoMethodError => _
17
+ nil
18
+ end
19
+ end
20
+ end
21
+
22
+ class StringMap
23
+ class << self
24
+ def [](hash, *keys)
25
+ return hash if keys.empty? || hash.nil?
26
+ key = keys.shift
27
+ if hash.is_a?(Array)
28
+ map = hash.map { |i| [i, key] }
29
+ else
30
+ map = hash[key]
31
+ end
32
+ [map, *keys]
33
+ rescue NoMethodError => _
34
+ nil
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,10 @@
1
+ name: complete
2
+ title: complete example profile
3
+ maintainer: Chef Software, Inc.
4
+ copyright: Chef Software, Inc.
5
+ copyright_email: support@chef.io
6
+ license: Proprietary, All rights reserved
7
+ summary: Testing stub
8
+ version: 1.0.0
9
+ supports:
10
+ - os-family: linux
@@ -0,0 +1,3 @@
1
+ class Tiny < Inspec.resource(1)
2
+ name 'tiny'
3
+ end
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: 0.27.0
4
+ version: 0.27.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-11 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train
@@ -318,6 +318,7 @@ files:
318
318
  - lib/resources/bash.rb
319
319
  - lib/resources/bond.rb
320
320
  - lib/resources/bridge.rb
321
+ - lib/resources/cache.rb
321
322
  - lib/resources/command.rb
322
323
  - lib/resources/csv.rb
323
324
  - lib/resources/directory.rb
@@ -376,6 +377,7 @@ files:
376
377
  - lib/utils/filter_array.rb
377
378
  - lib/utils/find_files.rb
378
379
  - lib/utils/hash.rb
380
+ - lib/utils/hash_map.rb
379
381
  - lib/utils/json_log.rb
380
382
  - lib/utils/modulator.rb
381
383
  - lib/utils/object_traversal.rb
@@ -573,6 +575,8 @@ files:
573
575
  - test/unit/mock/profiles/library/inspec.yml
574
576
  - test/unit/mock/profiles/library/libraries/gordonlib.rb
575
577
  - test/unit/mock/profiles/library/libraries/testlib.rb
578
+ - test/unit/mock/profiles/resource-tiny/inspec.yml
579
+ - test/unit/mock/profiles/resource-tiny/libraries/resource.rb
576
580
  - test/unit/mock/profiles/simple-metadata/inspec.yml
577
581
  - test/unit/mock/profiles/skippy-profile-os/controls/one.rb
578
582
  - test/unit/mock/profiles/skippy-profile-os/inspec.yml
@@ -662,7 +666,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
662
666
  version: '0'
663
667
  requirements: []
664
668
  rubyforge_project:
665
- rubygems_version: 2.4.6
669
+ rubygems_version: 2.5.1
666
670
  signing_key:
667
671
  specification_version: 4
668
672
  summary: Infrastructure and compliance testing.
@@ -857,6 +861,8 @@ test_files:
857
861
  - test/unit/mock/profiles/library/inspec.yml
858
862
  - test/unit/mock/profiles/library/libraries/gordonlib.rb
859
863
  - test/unit/mock/profiles/library/libraries/testlib.rb
864
+ - test/unit/mock/profiles/resource-tiny/inspec.yml
865
+ - test/unit/mock/profiles/resource-tiny/libraries/resource.rb
860
866
  - test/unit/mock/profiles/simple-metadata/inspec.yml
861
867
  - test/unit/mock/profiles/skippy-profile-os/controls/one.rb
862
868
  - test/unit/mock/profiles/skippy-profile-os/inspec.yml