inspec-core 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: e8f9909b462e77ca666275bb82308ea451a68ead2f5498aa111d74a55f5a6f64
4
- data.tar.gz: 002c18ea92f6c1879f5e8abdc53231a673b0bac7b66ce9042363a10504ebb424
3
+ metadata.gz: dda2c82e4eee5fbc41c0963a8b767d3afb617b55c80b84a81334bef2d086dba5
4
+ data.tar.gz: 1c9b9b15341380af7150cadb89b56ee0f86711880325a78c3adb6cce348ed800
5
5
  SHA512:
6
- metadata.gz: 642c43b3305289773a3fe75d286c5c0eaae10fa2ff869541aed3eb683a0e04bbf2d839bf3665e11eca1f87fcdf909de99885c3822035c37db2e7b5ffc876da8a
7
- data.tar.gz: 7df8c80861da7a4a252a47d02f50a1d3f138abf1cd4021c78462d3174176a623a81a0f1071ad8031b73dfd32f5f41eb3224c982a667a132d2ffefc569078a443
6
+ metadata.gz: 629f0ac2f1d7fe9996c6e24a61b6652e7d82cd71dd630c6893c6d7975ccc4e9db4aa4eff964a2eff54f25b5b7480fddcbc542c19daa0a29ef849d38ec63c8de7
7
+ data.tar.gz: ade62e212feeb71e1ae89e4c3aa9151c99f1baa548b1819549d1cfe30409ee178f0ae9eafe19522d55f2f9c6d2d051cf1796f36567408001e5b45dba4e288b61
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-core
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-core