inspec 2.3.4 → 2.3.5

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: 1e9a4bdc61290bace400878278ede4c09824a0edc8c14c2f3f9b6d2737f46058
4
- data.tar.gz: 0ee613addabeb1b49e304e4d35fb87a5134f9e66ccfec913f188d987444516f5
3
+ metadata.gz: 2563861cf6fc6a68aa706c45b9eee94b2843429fd4bd49d84f9dd1dcf0ddde4e
4
+ data.tar.gz: bef95a1410a887e15ce6fc22bf4a38c7cbfcde3507f2f969a99dc740a9601355
5
5
  SHA512:
6
- metadata.gz: 9869319175d8a4769cbf7a540e4c4d2c383e87ea8ed1c06656e933473e8e50224bcc321be65e0bf8dd6a45eadd1700826bef341dad4de6f9cf834d2c35688251
7
- data.tar.gz: 486383709c684ee46d1b7ad16e7475fe0cd286a13ea6738554a5d05ea3db08b725a1f663d2b6a4532262521729797a1146ec6d24748df0f100c32daa47b7b8fa
6
+ metadata.gz: 5cef35305f5ad3894b168efb7c2d502dd1d8ef3923ee01fe43aa3ac7d4b5aa8e86ebfc5562d230f1f35c6756423f9f7b1d6ffa45e0b3bf19f110244411c8f380
7
+ data.tar.gz: 484850ebb63fd31e554ec52f29b07d86ee543e35fabc9c36cce9cfc67d470499c14475dab199476af6a6a82c68a03ca1634ab63a08bf1b641708e9e578eda71b
data/CHANGELOG.md CHANGED
@@ -1,38 +1,44 @@
1
1
  # Change Log
2
2
  <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
3
- <!-- latest_release 2.3.4 -->
4
- ## [v2.3.4](https://github.com/inspec/inspec/tree/v2.3.4) (2018-09-27)
3
+ <!-- latest_release 2.3.5 -->
4
+ ## [v2.3.5](https://github.com/inspec/inspec/tree/v2.3.5) (2018-09-28)
5
5
 
6
- #### New Features
7
- - Plugins: Support for Train Plugins in InSpec [#3444](https://github.com/inspec/inspec/pull/3444) ([clintoncwolfe](https://github.com/clintoncwolfe))
6
+ #### Bug Fixes
7
+ - Update plugin gem install code [#3453](https://github.com/inspec/inspec/pull/3453) ([jquick](https://github.com/jquick))
8
8
  <!-- latest_release -->
9
9
 
10
- <!-- release_rollup since=2.2.112 -->
11
- ### Changes since 2.2.112 release
12
-
13
- #### Enhancements
14
- - Support the Busybox variant of netstat in the port resource [#3425](https://github.com/inspec/inspec/pull/3425) ([RoboticCheese](https://github.com/RoboticCheese)) <!-- 2.2.119 -->
15
-
16
- #### Merged Pull Requests
17
- - Plugins: Example CLI Plugin, a Resource Lister [#3421](https://github.com/inspec/inspec/pull/3421) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.3.3 -->
18
- - Pin postgresql to a lower cookbook version [#3449](https://github.com/inspec/inspec/pull/3449) ([jquick](https://github.com/jquick)) <!-- 2.3.2 -->
19
- - RFC inspec style guide [#3356](https://github.com/inspec/inspec/pull/3356) ([arlimus](https://github.com/arlimus)) <!-- 2.3.1 -->
20
- - Bump minor version [#3448](https://github.com/inspec/inspec/pull/3448) ([jquick](https://github.com/jquick)) <!-- 2.3.0 -->
21
- - Add support for multiple descriptions for controls [#3424](https://github.com/inspec/inspec/pull/3424) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 2.2.120 -->
22
- - Plugins: Load all CLI commands on usage on empty invocation [#3428](https://github.com/inspec/inspec/pull/3428) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.118 -->
23
- - Fix v2 loader appveyor issue [#3434](https://github.com/inspec/inspec/pull/3434) ([jquick](https://github.com/jquick)) <!-- 2.2.116 -->
24
- - Add new resource: aws_ebs_volume [#3381](https://github.com/inspec/inspec/pull/3381) ([jmassardo](https://github.com/jmassardo)) <!-- 2.2.115 -->
10
+ <!-- release_rollup since=2.3.4 -->
11
+ ### Changes since 2.3.4 release
25
12
 
26
13
  #### Bug Fixes
27
- - Grammar correction in error message: use &quot;an&quot; with attribute and unknown [#3439](https://github.com/inspec/inspec/pull/3439) ([alexpop](https://github.com/alexpop)) <!-- 2.2.117 -->
28
- - Remove load locks for cloud resources [#3420](https://github.com/inspec/inspec/pull/3420) ([jquick](https://github.com/jquick)) <!-- 2.2.114 -->
14
+ - Update plugin gem install code [#3453](https://github.com/inspec/inspec/pull/3453) ([jquick](https://github.com/jquick)) <!-- 2.3.5 -->
15
+ <!-- release_rollup -->
16
+
17
+ <!-- latest_stable_release -->
18
+ ## [v2.3.4](https://github.com/inspec/inspec/tree/v2.3.4) (2018-09-28)
29
19
 
30
20
  #### New Features
31
- - Plugins: Support for Train Plugins in InSpec [#3444](https://github.com/inspec/inspec/pull/3444) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.3.4 -->
32
- - Plugins Installer API [#3352](https://github.com/inspec/inspec/pull/3352) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.113 -->
33
- <!-- release_rollup -->
21
+ - Plugins Installer API [#3352](https://github.com/inspec/inspec/pull/3352) ([clintoncwolfe](https://github.com/clintoncwolfe))
22
+ - Plugins: Support for Train Plugins in InSpec [#3444](https://github.com/inspec/inspec/pull/3444) ([clintoncwolfe](https://github.com/clintoncwolfe))
34
23
 
24
+ #### Enhancements
25
+ - Support the Busybox variant of netstat in the port resource [#3425](https://github.com/inspec/inspec/pull/3425) ([RoboticCheese](https://github.com/RoboticCheese))
26
+
27
+ #### Bug Fixes
28
+ - Remove load locks for cloud resources [#3420](https://github.com/inspec/inspec/pull/3420) ([jquick](https://github.com/jquick))
29
+ - Grammar correction in error message: use &quot;an&quot; with attribute and unknown [#3439](https://github.com/inspec/inspec/pull/3439) ([alexpop](https://github.com/alexpop))
30
+
31
+ #### Merged Pull Requests
32
+ - Add new resource: aws_ebs_volume [#3381](https://github.com/inspec/inspec/pull/3381) ([jmassardo](https://github.com/jmassardo))
33
+ - Fix v2 loader appveyor issue [#3434](https://github.com/inspec/inspec/pull/3434) ([jquick](https://github.com/jquick))
34
+ - Plugins: Load all CLI commands on usage on empty invocation [#3428](https://github.com/inspec/inspec/pull/3428) ([clintoncwolfe](https://github.com/clintoncwolfe))
35
+ - Add support for multiple descriptions for controls [#3424](https://github.com/inspec/inspec/pull/3424) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
36
+ - Bump minor version [#3448](https://github.com/inspec/inspec/pull/3448) ([jquick](https://github.com/jquick))
37
+ - RFC inspec style guide [#3356](https://github.com/inspec/inspec/pull/3356) ([arlimus](https://github.com/arlimus))
38
+ - Pin postgresql to a lower cookbook version [#3449](https://github.com/inspec/inspec/pull/3449) ([jquick](https://github.com/jquick))
39
+ - Plugins: Example CLI Plugin, a Resource Lister [#3421](https://github.com/inspec/inspec/pull/3421) ([clintoncwolfe](https://github.com/clintoncwolfe))
35
40
  <!-- latest_stable_release -->
41
+
36
42
  ## [v2.2.112](https://github.com/inspec/inspec/tree/v2.2.112) (2018-09-19)
37
43
 
38
44
  #### New Features
@@ -50,7 +56,6 @@
50
56
  - Fix gem tests from recent merge [#3409](https://github.com/inspec/inspec/pull/3409) ([jquick](https://github.com/jquick))
51
57
  - Move inspec init to v2 plugins [#3407](https://github.com/inspec/inspec/pull/3407) ([jquick](https://github.com/jquick))
52
58
  - Move artifact to v2 plugin [#3406](https://github.com/inspec/inspec/pull/3406) ([jquick](https://github.com/jquick))
53
- <!-- latest_stable_release -->
54
59
 
55
60
  ## [v2.2.102](https://github.com/inspec/inspec/tree/v2.2.102) (2018-09-17)
56
61
 
@@ -248,10 +248,10 @@ module Inspec::Plugin::V2
248
248
  end
249
249
 
250
250
  def install_from_gem_file(requested_plugin_name, opts)
251
- plugin_dependency = Gem::Dependency.new(requested_plugin_name)
252
-
253
251
  # Make Set that encompasses just the gemfile that was provided
254
252
  plugin_local_source = Gem::Source::SpecificFile.new(opts[:gem_file])
253
+
254
+ plugin_dependency = Gem::Dependency.new(requested_plugin_name, plugin_local_source.spec.version)
255
255
  requested_local_gem_set = Gem::Resolver::InstallerSet.new(:both) # :both means local and remote; allow satisfying our gemfile's deps from rubygems.org
256
256
  requested_local_gem_set.add_local(plugin_dependency.name, plugin_local_source.spec, plugin_local_source)
257
257
 
@@ -264,7 +264,7 @@ module Inspec::Plugin::V2
264
264
  install_gem_to_plugins_dir(plugin_dependency, [Gem::Resolver::BestSet.new], opts[:update_mode])
265
265
  end
266
266
 
267
- def install_gem_to_plugins_dir(new_plugin_dependency, extra_request_sets = [], update_mode = false)
267
+ def install_gem_to_plugins_dir(new_plugin_dependency, extra_request_sets = [], update_mode = false) # rubocop: disable Metrics/AbcSize
268
268
  # Get a list of all the gems available to us.
269
269
  gem_to_force_update = update_mode ? new_plugin_dependency.name : nil
270
270
  set_available_for_resolution = build_gem_request_universe(extra_request_sets, gem_to_force_update)
@@ -272,7 +272,7 @@ module Inspec::Plugin::V2
272
272
  # Solve the dependency (that is, find a way to install the new plugin and anything it needs)
273
273
  request_set = Gem::RequestSet.new(new_plugin_dependency)
274
274
  begin
275
- request_set.resolve(set_available_for_resolution)
275
+ solution = request_set.resolve(set_available_for_resolution)
276
276
  rescue Gem::UnsatisfiableDependencyError => gem_ex
277
277
  # TODO: use search facility to determine if the requested gem exists at all, vs if the constraints are impossible
278
278
  ex = Inspec::Plugin::V2::InstallError.new(gem_ex.message)
@@ -280,6 +280,29 @@ module Inspec::Plugin::V2
280
280
  raise ex
281
281
  end
282
282
 
283
+ # Activate all current plugins before trying to activate the new one
284
+ loader.list_managed_gems.each do |spec|
285
+ next if spec.name == new_plugin_dependency.name && update_mode
286
+ spec.activate
287
+ end
288
+
289
+ # Make sure we remove any previously loaded gem on update
290
+ Gem.loaded_specs.delete(new_plugin_dependency.name) if update_mode
291
+
292
+ # Test activating the solution. This makes sure we do not try to load two different versions
293
+ # of the same gem on the stack or a malformed dependency.
294
+ begin
295
+ solution.each do |activation_request|
296
+ unless activation_request.full_spec.activated?
297
+ activation_request.full_spec.activate
298
+ end
299
+ end
300
+ rescue Gem::LoadError => gem_ex
301
+ ex = Inspec::Plugin::V2::InstallError.new(gem_ex.message)
302
+ ex.plugin_name = new_plugin_dependency.name
303
+ raise ex
304
+ end
305
+
283
306
  # OK, perform the installation.
284
307
  # Ignore deps here, because any needed deps should already be baked into new_plugin_dependency
285
308
  request_set.install_into(gem_path, true, ignore_dependencies: true)
@@ -358,6 +381,18 @@ module Inspec::Plugin::V2
358
381
  # Utilities
359
382
  #===================================================================#
360
383
 
384
+ # This class alows us to build a Vendor set with the gems that are
385
+ # already included either with Ruby or with the InSpec install
386
+ class InstalledVendorSet < Gem::Resolver::VendorSet
387
+ def initialize
388
+ super
389
+ Gem::Specification.find_all do |spec|
390
+ @specs[spec.name] = spec
391
+ @directories[spec] = spec.gem_dir
392
+ end
393
+ end
394
+ end
395
+
361
396
  # Provides a RequestSet (a set of gems representing the gems that are available to
362
397
  # solve a dependency request) that represents a combination of:
363
398
  # * the gems included in the system
@@ -374,7 +409,7 @@ module Inspec::Plugin::V2
374
409
  # Combine the Sets, so the resolver has one composite place to look
375
410
  Gem::Resolver.compose_sets(
376
411
  installed_plugins_gem_set, # The gems that are in the plugin gem path directory tree
377
- Gem::Resolver::CurrentSet.new, # The gems that are already included either with Ruby or with the InSpec install
412
+ InstalledVendorSet.new,
378
413
  *extra_request_sets, # Anything else our caller wanted to include
379
414
  )
380
415
  end
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '2.3.4'
7
+ VERSION = '2.3.5'
8
8
  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: 2.3.4
4
+ version: 2.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train