kitchen-terraform 3.3.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +45 -28
- data/lib/kitchen/driver/terraform.rb +87 -66
- data/lib/kitchen/provisioner/terraform.rb +1 -1
- data/lib/kitchen/terraform/client_version_verifier.rb +3 -3
- data/lib/kitchen/terraform/command/output.rb +43 -40
- data/lib/kitchen/{verifier/terraform/configure_inspec_runner_host.rb → terraform/config_attribute/systems.rb} +18 -11
- data/lib/kitchen/terraform/config_attribute/variable_files.rb +1 -1
- data/lib/kitchen/terraform/config_schemas/system.rb +555 -0
- data/lib/kitchen/terraform/{breaking/kitchen_instance.rb → config_schemas/systems.rb} +16 -5
- data/lib/kitchen/terraform/configurable.rb +2 -6
- data/lib/kitchen/terraform/inspec.rb +74 -0
- data/lib/kitchen/terraform/inspec_options_mapper.rb +49 -0
- data/lib/kitchen/terraform/inspec_with_hosts.rb +49 -0
- data/lib/kitchen/terraform/inspec_without_hosts.rb +44 -0
- data/lib/kitchen/terraform/shell_out.rb +13 -10
- data/lib/kitchen/terraform/system.rb +120 -0
- data/lib/kitchen/terraform/system_attrs_resolver.rb +57 -0
- data/lib/kitchen/terraform/system_hosts_resolver.rb +45 -0
- data/lib/kitchen/terraform/version.rb +60 -17
- data/lib/kitchen/verifier/terraform.rb +162 -156
- metadata +45 -41
- metadata.gz.sig +0 -0
- data/lib/kitchen/terraform/config_attribute/groups.rb +0 -148
- data/lib/kitchen/terraform/config_schemas/groups.rb +0 -52
- data/lib/kitchen/terraform/deprecating/kitchen_instance.rb +0 -61
- data/lib/kitchen/terraform/kitchen_instance.rb +0 -49
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_attributes.rb +0 -98
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_backend.rb +0 -32
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_controls.rb +0 -41
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_port.rb +0 -40
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_ssh_key.rb +0 -41
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_user.rb +0 -40
- data/lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb +0 -82
metadata
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lane
|
8
|
+
- Nick Willever
|
9
|
+
- Kevin Dickerson
|
10
|
+
- Nell Shamrell-Harrington
|
11
|
+
- Michael Glenney
|
12
|
+
- Walter Dolce
|
8
13
|
- Clay Thomas
|
9
|
-
- David Begin
|
10
14
|
- Erik R. Rygg
|
11
|
-
- Ewa Czechowska
|
12
|
-
- John Engelman
|
13
|
-
- Kevin Dickerson
|
14
15
|
- Kyle Sexton
|
16
|
+
- Ewa Czechowska
|
15
17
|
- Matt Long
|
16
|
-
-
|
17
|
-
- Nell Shamrell-Harrington
|
18
|
-
- Nick Willever
|
18
|
+
- John Engelman
|
19
19
|
- Steven A. Burns
|
20
|
-
-
|
20
|
+
- David Begin
|
21
21
|
- curleighbraces
|
22
|
+
- Austin Heiman
|
23
|
+
- Gary Foster
|
22
24
|
autorequire:
|
23
25
|
bindir: bin
|
24
26
|
cert_chain:
|
@@ -55,7 +57,7 @@ cert_chain:
|
|
55
57
|
XjOfZudLs1zJ8ZNOuwj6KkGJ9J3XHd9hM95MtBEWlxAfYdCuW1+v7zCTfbieBEba
|
56
58
|
UIyyldg4TuVcuRs8uKJyempT0hqx2DniseBWw3nvtgom3A==
|
57
59
|
-----END CERTIFICATE-----
|
58
|
-
date: 2018-
|
60
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
59
61
|
dependencies:
|
60
62
|
- !ruby/object:Gem::Dependency
|
61
63
|
name: bundler-audit
|
@@ -217,14 +219,14 @@ dependencies:
|
|
217
219
|
requirements:
|
218
220
|
- - "~>"
|
219
221
|
- !ruby/object:Gem::Version
|
220
|
-
version: 0.
|
222
|
+
version: 0.2.0
|
221
223
|
type: :development
|
222
224
|
prerelease: false
|
223
225
|
version_requirements: !ruby/object:Gem::Requirement
|
224
226
|
requirements:
|
225
227
|
- - "~>"
|
226
228
|
- !ruby/object:Gem::Version
|
227
|
-
version: 0.
|
229
|
+
version: 0.2.0
|
228
230
|
- !ruby/object:Gem::Dependency
|
229
231
|
name: pry
|
230
232
|
requirement: !ruby/object:Gem::Requirement
|
@@ -366,47 +368,53 @@ dependencies:
|
|
366
368
|
- !ruby/object:Gem::Version
|
367
369
|
version: '0.10'
|
368
370
|
- !ruby/object:Gem::Dependency
|
369
|
-
name:
|
371
|
+
name: mixlib-shellout
|
370
372
|
requirement: !ruby/object:Gem::Requirement
|
371
373
|
requirements:
|
372
374
|
- - "~>"
|
373
375
|
- !ruby/object:Gem::Version
|
374
|
-
version: '
|
376
|
+
version: '2.2'
|
375
377
|
type: :runtime
|
376
378
|
prerelease: false
|
377
379
|
version_requirements: !ruby/object:Gem::Requirement
|
378
380
|
requirements:
|
379
381
|
- - "~>"
|
380
382
|
- !ruby/object:Gem::Version
|
381
|
-
version: '
|
383
|
+
version: '2.2'
|
382
384
|
- !ruby/object:Gem::Dependency
|
383
|
-
name:
|
385
|
+
name: inspec
|
384
386
|
requirement: !ruby/object:Gem::Requirement
|
385
387
|
requirements:
|
386
|
-
- - "
|
388
|
+
- - ">="
|
387
389
|
- !ruby/object:Gem::Version
|
388
|
-
version:
|
390
|
+
version: 2.2.34
|
391
|
+
- - "<"
|
392
|
+
- !ruby/object:Gem::Version
|
393
|
+
version: '3'
|
389
394
|
type: :runtime
|
390
395
|
prerelease: false
|
391
396
|
version_requirements: !ruby/object:Gem::Requirement
|
392
397
|
requirements:
|
393
|
-
- - "
|
398
|
+
- - ">="
|
394
399
|
- !ruby/object:Gem::Version
|
395
|
-
version:
|
400
|
+
version: 2.2.34
|
401
|
+
- - "<"
|
402
|
+
- !ruby/object:Gem::Version
|
403
|
+
version: '3'
|
396
404
|
- !ruby/object:Gem::Dependency
|
397
405
|
name: test-kitchen
|
398
406
|
requirement: !ruby/object:Gem::Requirement
|
399
407
|
requirements:
|
400
408
|
- - "~>"
|
401
409
|
- !ruby/object:Gem::Version
|
402
|
-
version: '1.
|
410
|
+
version: '1.23'
|
403
411
|
type: :runtime
|
404
412
|
prerelease: false
|
405
413
|
version_requirements: !ruby/object:Gem::Requirement
|
406
414
|
requirements:
|
407
415
|
- - "~>"
|
408
416
|
- !ruby/object:Gem::Version
|
409
|
-
version: '1.
|
417
|
+
version: '1.23'
|
410
418
|
description: kitchen-terraform is a set of Test Kitchen plugins for testing Terraform
|
411
419
|
configuration
|
412
420
|
email: kitchen-terraform@newcontext.com
|
@@ -420,7 +428,6 @@ files:
|
|
420
428
|
- lib/kitchen/provisioner/terraform.rb
|
421
429
|
- lib/kitchen/terraform.rb
|
422
430
|
- lib/kitchen/terraform/breaking.rb
|
423
|
-
- lib/kitchen/terraform/breaking/kitchen_instance.rb
|
424
431
|
- lib/kitchen/terraform/client_version_verifier.rb
|
425
432
|
- lib/kitchen/terraform/command.rb
|
426
433
|
- lib/kitchen/terraform/command/output.rb
|
@@ -428,12 +435,12 @@ files:
|
|
428
435
|
- lib/kitchen/terraform/config_attribute/backend_configurations.rb
|
429
436
|
- lib/kitchen/terraform/config_attribute/color.rb
|
430
437
|
- lib/kitchen/terraform/config_attribute/command_timeout.rb
|
431
|
-
- lib/kitchen/terraform/config_attribute/groups.rb
|
432
438
|
- lib/kitchen/terraform/config_attribute/lock.rb
|
433
439
|
- lib/kitchen/terraform/config_attribute/lock_timeout.rb
|
434
440
|
- lib/kitchen/terraform/config_attribute/parallelism.rb
|
435
441
|
- lib/kitchen/terraform/config_attribute/plugin_directory.rb
|
436
442
|
- lib/kitchen/terraform/config_attribute/root_module_directory.rb
|
443
|
+
- lib/kitchen/terraform/config_attribute/systems.rb
|
437
444
|
- lib/kitchen/terraform/config_attribute/variable_files.rb
|
438
445
|
- lib/kitchen/terraform/config_attribute/variables.rb
|
439
446
|
- lib/kitchen/terraform/config_attribute_cacher.rb
|
@@ -446,32 +453,29 @@ files:
|
|
446
453
|
- lib/kitchen/terraform/config_schemas.rb
|
447
454
|
- lib/kitchen/terraform/config_schemas/array_of_strings.rb
|
448
455
|
- lib/kitchen/terraform/config_schemas/boolean.rb
|
449
|
-
- lib/kitchen/terraform/config_schemas/groups.rb
|
450
456
|
- lib/kitchen/terraform/config_schemas/optional_string.rb
|
451
457
|
- lib/kitchen/terraform/config_schemas/string.rb
|
458
|
+
- lib/kitchen/terraform/config_schemas/system.rb
|
459
|
+
- lib/kitchen/terraform/config_schemas/systems.rb
|
452
460
|
- lib/kitchen/terraform/configurable.rb
|
453
461
|
- lib/kitchen/terraform/deprecating.rb
|
454
|
-
- lib/kitchen/terraform/deprecating/kitchen_instance.rb
|
455
462
|
- lib/kitchen/terraform/error.rb
|
456
463
|
- lib/kitchen/terraform/file_path_config_attribute_definer.rb
|
457
|
-
- lib/kitchen/terraform/
|
464
|
+
- lib/kitchen/terraform/inspec.rb
|
465
|
+
- lib/kitchen/terraform/inspec_options_mapper.rb
|
466
|
+
- lib/kitchen/terraform/inspec_with_hosts.rb
|
467
|
+
- lib/kitchen/terraform/inspec_without_hosts.rb
|
458
468
|
- lib/kitchen/terraform/shell_out.rb
|
469
|
+
- lib/kitchen/terraform/system.rb
|
470
|
+
- lib/kitchen/terraform/system_attrs_resolver.rb
|
471
|
+
- lib/kitchen/terraform/system_hosts_resolver.rb
|
459
472
|
- lib/kitchen/terraform/version.rb
|
460
473
|
- lib/kitchen/verifier/terraform.rb
|
461
|
-
-
|
462
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_backend.rb
|
463
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_controls.rb
|
464
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_host.rb
|
465
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_port.rb
|
466
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_ssh_key.rb
|
467
|
-
- lib/kitchen/verifier/terraform/configure_inspec_runner_user.rb
|
468
|
-
- lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb
|
469
|
-
homepage: https://github.com/newcontext-oss/kitchen-terraform
|
474
|
+
homepage: https://newcontext-oss.github.io/kitchen-terraform/
|
470
475
|
licenses:
|
471
476
|
- Apache-2.0
|
472
477
|
metadata: {}
|
473
|
-
post_install_message:
|
474
|
-
will not be supported in an upcoming major release of Kitchen-Terraform'
|
478
|
+
post_install_message:
|
475
479
|
rdoc_options: []
|
476
480
|
require_paths:
|
477
481
|
- lib
|
@@ -479,7 +483,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
479
483
|
requirements:
|
480
484
|
- - ">="
|
481
485
|
- !ruby/object:Gem::Version
|
482
|
-
version: '2.
|
486
|
+
version: '2.3'
|
483
487
|
- - "<"
|
484
488
|
- !ruby/object:Gem::Version
|
485
489
|
version: '2.6'
|
@@ -489,9 +493,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
489
493
|
- !ruby/object:Gem::Version
|
490
494
|
version: '0'
|
491
495
|
requirements:
|
492
|
-
- Terraform >= 0.
|
496
|
+
- Terraform >= 0.11.4, < 0.12.0
|
493
497
|
rubyforge_project:
|
494
|
-
rubygems_version: 2.7.
|
498
|
+
rubygems_version: 2.7.7
|
495
499
|
signing_key:
|
496
500
|
specification_version: 4
|
497
501
|
summary: Test Kitchen plugins for testing Terraform configuration
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,148 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require "kitchen/terraform/config_attribute"
|
18
|
-
require "kitchen/terraform/config_schemas/groups"
|
19
|
-
|
20
|
-
# This attribute configures the execution of {https://www.inspec.io/docs/reference/profiles/ InSpec profiles} against
|
21
|
-
# different groups of resources in the Terraform state. Each group may be configured by using the proceeding attributes.
|
22
|
-
#
|
23
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760193 Sequence of mappings}
|
24
|
-
# Required:: False
|
25
|
-
#
|
26
|
-
# ===== name
|
27
|
-
#
|
28
|
-
# This key contains the name of the group to be used for logging purposes.
|
29
|
-
#
|
30
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760844 Scalar}
|
31
|
-
# Required:: True
|
32
|
-
# Example::
|
33
|
-
# _
|
34
|
-
# groups:
|
35
|
-
# -
|
36
|
-
# name: a_group
|
37
|
-
#
|
38
|
-
# ===== attributes
|
39
|
-
#
|
40
|
-
# This key comprises associations of the names of
|
41
|
-
# {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes} with the names of
|
42
|
-
# {https://www.terraform.io/docs/configuration/outputs.html Terraform outputs}. The values of the outputs will be
|
43
|
-
# exposed as attributes when InSpec executes.
|
44
|
-
#
|
45
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760142 Mapping of scalars to scalars}
|
46
|
-
# Required:: False
|
47
|
-
# Example::
|
48
|
-
# _
|
49
|
-
# groups:
|
50
|
-
# -
|
51
|
-
# name: a_group_with_overridden_attributes
|
52
|
-
# attributes:
|
53
|
-
# an_attribute: an_output
|
54
|
-
# Caveat:: As all Terraform outputs are associated with equivalently named InSpec profile attributes by default, this
|
55
|
-
# key is only necessary to provide alternative attribute names.
|
56
|
-
#
|
57
|
-
# ===== controls
|
58
|
-
#
|
59
|
-
# This key comprises the names of {https://www.inspec.io/docs/reference/dsl_inspec/ InSpec controls} to exclusively
|
60
|
-
# include from the InSpec profile of the associated Test Kitchen instance.
|
61
|
-
#
|
62
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760118 Sequince of scalars}
|
63
|
-
# Required:: False
|
64
|
-
# Example::
|
65
|
-
# _
|
66
|
-
# groups:
|
67
|
-
# -
|
68
|
-
# name: a_group_with_a_first_subset_of_controls
|
69
|
-
# controls:
|
70
|
-
# - control_one
|
71
|
-
# - control_three
|
72
|
-
# -
|
73
|
-
# name: a_group_with_a_second_subset_of_controls
|
74
|
-
# controls:
|
75
|
-
# - control_two
|
76
|
-
# - control_four
|
77
|
-
#
|
78
|
-
# ===== hostnames
|
79
|
-
#
|
80
|
-
# This key contains the name of a Terraform output which provides one or more hostnames to be targeted by the InSpec
|
81
|
-
# profile of the associated Test Kitchen instance.
|
82
|
-
#
|
83
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760844 Scalar}
|
84
|
-
# Required:: False
|
85
|
-
# Example::
|
86
|
-
# _
|
87
|
-
# groups:
|
88
|
-
# -
|
89
|
-
# name: a_group_with_hostnames
|
90
|
-
# hostnames: an_output
|
91
|
-
# Caveat:: The output must be a string or an array of strings. If this key is omitted then +"localhost"+ will be the
|
92
|
-
# target of the profile. To connect to the hosts through a bastion host, a +ProxyCommand+ in the
|
93
|
-
# appropriate {https://linux.die.net/man/5/ssh_config SSH configuration file} must be configured on the system.
|
94
|
-
#
|
95
|
-
# ===== port
|
96
|
-
#
|
97
|
-
# This key contains the port to use when connecting with {https://en.wikipedia.org/wiki/Secure_Shell Secure Shell (SSH)}
|
98
|
-
# to the hosts of the group.
|
99
|
-
#
|
100
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803828 Integer}
|
101
|
-
# Required:: False
|
102
|
-
# Example::
|
103
|
-
# _
|
104
|
-
# groups:
|
105
|
-
# -
|
106
|
-
# name: a_group_with_a_port
|
107
|
-
# port: 1234
|
108
|
-
# Caveat:: If this key is omitted then the port of the Test Kitchen SSH transport will be used.
|
109
|
-
#
|
110
|
-
# ===== ssh_key
|
111
|
-
#
|
112
|
-
# This key contains the path to a private SSH key to use when connecting with SSH to the hosts of the group.
|
113
|
-
#
|
114
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760844 Scalar}
|
115
|
-
# Required:: False
|
116
|
-
# Example::
|
117
|
-
# _
|
118
|
-
# groups:
|
119
|
-
# -
|
120
|
-
# name: a_group_with_an_ssh_key
|
121
|
-
# ssh_key: /path/to/an/ssh/key</
|
122
|
-
# Caveat:: If this key is omitted then the private SSH key of the Test Kitchen SSH Transport will be used.
|
123
|
-
#
|
124
|
-
# ===== username
|
125
|
-
#
|
126
|
-
# This key contains the username to use when connecting with SSH to the hosts of the group.
|
127
|
-
#
|
128
|
-
# Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760844 Scalar}
|
129
|
-
# Required:: False
|
130
|
-
# Example::
|
131
|
-
# _
|
132
|
-
# groups:
|
133
|
-
# -
|
134
|
-
# name: a_group_with_a_username
|
135
|
-
# username: tester
|
136
|
-
# Caveat:: If this key is omitted then the username of the Test Kitcen SSH Transport will be used.
|
137
|
-
module ::Kitchen::Terraform::ConfigAttribute::Groups
|
138
|
-
::Kitchen::Terraform::ConfigAttribute
|
139
|
-
.new(
|
140
|
-
attribute: :groups,
|
141
|
-
default_value:
|
142
|
-
lambda do
|
143
|
-
[]
|
144
|
-
end,
|
145
|
-
schema: ::Kitchen::Terraform::ConfigSchemas::Groups
|
146
|
-
)
|
147
|
-
.apply config_attribute: self
|
148
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require "dry-validation"
|
18
|
-
require "kitchen/terraform/config_predicates/hash_of_symbols_and_strings"
|
19
|
-
require "kitchen/terraform/config_schemas"
|
20
|
-
|
21
|
-
# A validation schema for the groups configuration attribute which is an array of hashes including only symbol keys and
|
22
|
-
# string values.
|
23
|
-
#
|
24
|
-
# @see http://dry-rb.org/gems/dry-validation/basics/working-with-schemas/ DRY Validation Working With Schemas
|
25
|
-
::Kitchen::Terraform::ConfigSchemas::Groups =
|
26
|
-
::Dry::Validation
|
27
|
-
.Schema do
|
28
|
-
configure do
|
29
|
-
predicates ::Kitchen::Terraform::ConfigPredicates::HashOfSymbolsAndStrings
|
30
|
-
extend ::Kitchen::Terraform::ConfigPredicates::HashOfSymbolsAndStrings
|
31
|
-
end
|
32
|
-
required(:value)
|
33
|
-
.each do
|
34
|
-
schema do
|
35
|
-
required(:name).filled :str?
|
36
|
-
optional(:attributes).value :hash_of_symbols_and_strings?
|
37
|
-
optional(:controls)
|
38
|
-
.each(
|
39
|
-
:filled?,
|
40
|
-
:str?
|
41
|
-
)
|
42
|
-
optional(:hostnames).value :str?
|
43
|
-
optional(:port).value :int?
|
44
|
-
optional(:ssh_key)
|
45
|
-
.maybe(
|
46
|
-
:str?,
|
47
|
-
:filled?
|
48
|
-
)
|
49
|
-
optional(:username).value :str?
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require "delegate"
|
18
|
-
require "kitchen"
|
19
|
-
require "kitchen/terraform/deprecating"
|
20
|
-
|
21
|
-
# This class provides the deprecating change to the KitchenInstance.
|
22
|
-
class ::Kitchen::Terraform::Deprecating::KitchenInstance < DelegateClass ::Kitchen::Instance
|
23
|
-
private
|
24
|
-
|
25
|
-
# Runs a given action block directly.
|
26
|
-
#
|
27
|
-
# If the desired action is one of +:create+, +:converge+, +:setup+, or +:destroy+, and there is more than one thread
|
28
|
-
# active, then a warning is issued about deprecating support for concurrency with the desired action.
|
29
|
-
#
|
30
|
-
# @api private
|
31
|
-
# @param action [::Symbol] the action to be performed
|
32
|
-
# @param state [::Hash] a mutable state hash for this instance
|
33
|
-
# @see ::Kitchen::Instance
|
34
|
-
# @yieldparam state [::Hash] a mutable state hash for this instance
|
35
|
-
def synchronize_or_call(action, state)
|
36
|
-
::Thread
|
37
|
-
.list
|
38
|
-
.length
|
39
|
-
.>(1) and
|
40
|
-
issue_warning action: action
|
41
|
-
|
42
|
-
yield state
|
43
|
-
end
|
44
|
-
|
45
|
-
# @api private
|
46
|
-
def issue_warning(action:)
|
47
|
-
[
|
48
|
-
:create,
|
49
|
-
:converge,
|
50
|
-
:setup,
|
51
|
-
:destroy
|
52
|
-
]
|
53
|
-
.grep action do |serial_action|
|
54
|
-
warn(
|
55
|
-
"DEPRECATING: #{to_str} is about to invoke #{driver.class}##{serial_action} with concurrency " \
|
56
|
-
"activated; this action will be forced to run serially in an upcoming major version of " \
|
57
|
-
"Kitchen-Terraform"
|
58
|
-
)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|