kitchen-terraform 5.8.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +17 -16
  5. data/lib/kitchen/driver/terraform.rb +1 -1
  6. data/lib/kitchen/provisioner/terraform.rb +1 -1
  7. data/lib/kitchen/terraform.rb +1 -1
  8. data/lib/kitchen/terraform/breaking.rb +1 -1
  9. data/lib/kitchen/terraform/command.rb +1 -1
  10. data/lib/kitchen/terraform/command/apply.rb +1 -1
  11. data/lib/kitchen/terraform/command/destroy.rb +1 -1
  12. data/lib/kitchen/terraform/command/get.rb +1 -1
  13. data/lib/kitchen/terraform/command/init.rb +1 -1
  14. data/lib/kitchen/terraform/command/init/post_zero_fifteen_zero.rb +1 -1
  15. data/lib/kitchen/terraform/command/init/pre_zero_fifteen_zero.rb +1 -1
  16. data/lib/kitchen/terraform/command/init_factory.rb +1 -1
  17. data/lib/kitchen/terraform/command/output.rb +1 -1
  18. data/lib/kitchen/terraform/command/validate.rb +1 -1
  19. data/lib/kitchen/terraform/command/validate/post_zero_fifteen_zero.rb +1 -1
  20. data/lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb +1 -1
  21. data/lib/kitchen/terraform/command/validate_factory.rb +1 -1
  22. data/lib/kitchen/terraform/command/version.rb +1 -1
  23. data/lib/kitchen/terraform/command/workspace_delete.rb +1 -1
  24. data/lib/kitchen/terraform/command/workspace_new.rb +1 -1
  25. data/lib/kitchen/terraform/command/workspace_select.rb +1 -1
  26. data/lib/kitchen/terraform/command_executor.rb +3 -5
  27. data/lib/kitchen/terraform/command_flag.rb +1 -1
  28. data/lib/kitchen/terraform/command_flag/backend_config.rb +1 -1
  29. data/lib/kitchen/terraform/command_flag/color.rb +1 -1
  30. data/lib/kitchen/terraform/command_flag/lock_timeout.rb +1 -1
  31. data/lib/kitchen/terraform/command_flag/plugin_dir.rb +1 -1
  32. data/lib/kitchen/terraform/command_flag/upgrade.rb +1 -1
  33. data/lib/kitchen/terraform/command_flag/var.rb +1 -1
  34. data/lib/kitchen/terraform/command_flag/var_file.rb +1 -1
  35. data/lib/kitchen/terraform/config_attribute.rb +1 -1
  36. data/lib/kitchen/terraform/config_attribute/backend_configurations.rb +1 -1
  37. data/lib/kitchen/terraform/config_attribute/client.rb +3 -3
  38. data/lib/kitchen/terraform/config_attribute/color.rb +3 -3
  39. data/lib/kitchen/terraform/config_attribute/command_timeout.rb +1 -1
  40. data/lib/kitchen/terraform/config_attribute/fail_fast.rb +3 -3
  41. data/lib/kitchen/terraform/config_attribute/lock.rb +3 -3
  42. data/lib/kitchen/terraform/config_attribute/lock_timeout.rb +1 -1
  43. data/lib/kitchen/terraform/config_attribute/parallelism.rb +1 -1
  44. data/lib/kitchen/terraform/config_attribute/plugin_directory.rb +3 -3
  45. data/lib/kitchen/terraform/config_attribute/root_module_directory.rb +3 -3
  46. data/lib/kitchen/terraform/config_attribute/systems.rb +552 -4
  47. data/lib/kitchen/terraform/config_attribute/variable_files.rb +3 -3
  48. data/lib/kitchen/terraform/config_attribute/variables.rb +1 -1
  49. data/lib/kitchen/terraform/config_attribute/verify_version.rb +3 -3
  50. data/lib/kitchen/terraform/config_attribute_cacher.rb +1 -1
  51. data/lib/kitchen/terraform/{config_predicates.rb → config_attribute_contract.rb} +3 -3
  52. data/lib/kitchen/terraform/config_attribute_contract/array_of_strings.rb +30 -0
  53. data/lib/kitchen/terraform/{config_schemas → config_attribute_contract}/boolean.rb +7 -11
  54. data/lib/kitchen/terraform/config_attribute_contract/hash_of_symbols_and_strings.rb +41 -0
  55. data/lib/kitchen/terraform/{config_schemas.rb → config_attribute_contract/integer.rb} +10 -3
  56. data/lib/kitchen/terraform/config_attribute_contract/optional_string.rb +30 -0
  57. data/lib/kitchen/terraform/{config_schemas → config_attribute_contract}/string.rb +7 -9
  58. data/lib/kitchen/terraform/config_attribute_contract/systems.rb +63 -0
  59. data/lib/kitchen/terraform/config_attribute_definer.rb +2 -2
  60. data/lib/kitchen/terraform/config_attribute_type.rb +1 -1
  61. data/lib/kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings.rb +9 -16
  62. data/lib/kitchen/terraform/config_attribute_type/integer.rb +27 -23
  63. data/lib/kitchen/terraform/configurable.rb +1 -1
  64. data/lib/kitchen/terraform/debug_logger.rb +1 -1
  65. data/lib/kitchen/terraform/deprecating.rb +1 -1
  66. data/lib/kitchen/terraform/driver.rb +1 -1
  67. data/lib/kitchen/terraform/driver/create.rb +5 -5
  68. data/lib/kitchen/terraform/driver/destroy.rb +8 -8
  69. data/lib/kitchen/terraform/error.rb +1 -1
  70. data/lib/kitchen/terraform/file_path_config_attribute_definer.rb +1 -1
  71. data/lib/kitchen/terraform/inspec.rb +1 -1
  72. data/lib/kitchen/terraform/inspec/fail_fast_with_hosts.rb +1 -1
  73. data/lib/kitchen/terraform/inspec/fail_slow_with_hosts.rb +1 -1
  74. data/lib/kitchen/terraform/inspec/without_hosts.rb +1 -1
  75. data/lib/kitchen/terraform/inspec_factory.rb +1 -1
  76. data/lib/kitchen/terraform/inspec_options_factory.rb +1 -1
  77. data/lib/kitchen/terraform/inspec_runner.rb +1 -1
  78. data/lib/kitchen/terraform/outputs_manager.rb +1 -1
  79. data/lib/kitchen/terraform/outputs_parser.rb +1 -1
  80. data/lib/kitchen/terraform/outputs_reader.rb +2 -2
  81. data/lib/kitchen/terraform/provisioner.rb +1 -1
  82. data/lib/kitchen/terraform/provisioner/converge.rb +6 -6
  83. data/lib/kitchen/terraform/raise.rb +1 -1
  84. data/lib/kitchen/terraform/raise/action_failed.rb +1 -1
  85. data/lib/kitchen/terraform/raise/client_error.rb +1 -1
  86. data/lib/kitchen/terraform/shell_out.rb +2 -2
  87. data/lib/kitchen/terraform/system.rb +1 -1
  88. data/lib/kitchen/terraform/system_attrs_inputs_resolver.rb +1 -1
  89. data/lib/kitchen/terraform/system_attrs_outputs_resolver.rb +1 -1
  90. data/lib/kitchen/terraform/system_bastion_host_resolver.rb +1 -1
  91. data/lib/kitchen/terraform/system_hosts_resolver.rb +1 -1
  92. data/lib/kitchen/terraform/system_inspec_map.rb +1 -1
  93. data/lib/kitchen/terraform/systems_verifier.rb +1 -1
  94. data/lib/kitchen/terraform/systems_verifier/fail_fast.rb +1 -1
  95. data/lib/kitchen/terraform/systems_verifier/fail_slow.rb +1 -1
  96. data/lib/kitchen/terraform/systems_verifier_factory.rb +1 -1
  97. data/lib/kitchen/terraform/unsupported_client_version_error.rb +1 -1
  98. data/lib/kitchen/terraform/variables_manager.rb +1 -1
  99. data/lib/kitchen/terraform/verify_version.rb +1 -1
  100. data/lib/kitchen/terraform/verify_version_rescue_strategy.rb +1 -1
  101. data/lib/kitchen/terraform/verify_version_rescue_strategy/permissive.rb +1 -1
  102. data/lib/kitchen/terraform/verify_version_rescue_strategy/strict.rb +1 -1
  103. data/lib/kitchen/terraform/verify_version_rescue_strategy_factory.rb +1 -1
  104. data/lib/kitchen/terraform/version.rb +2 -2
  105. data/lib/kitchen/terraform/version_verifier.rb +1 -1
  106. data/lib/kitchen/terraform/version_verifier_strategy.rb +1 -1
  107. data/lib/kitchen/terraform/version_verifier_strategy/supported.rb +1 -1
  108. data/lib/kitchen/terraform/version_verifier_strategy/unsupported.rb +1 -1
  109. data/lib/kitchen/terraform/version_verifier_strategy_factory.rb +1 -1
  110. data/lib/kitchen/verifier/terraform.rb +1 -1
  111. metadata +60 -49
  112. metadata.gz.sig +0 -0
  113. data/lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb +0 -81
  114. data/lib/kitchen/terraform/config_schemas/array_of_strings.rb +0 -38
  115. data/lib/kitchen/terraform/config_schemas/optional_string.rb +0 -38
  116. data/lib/kitchen/terraform/config_schemas/system.rb +0 -609
  117. data/lib/kitchen/terraform/config_schemas/systems.rb +0 -37
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ module Kitchen
71
71
 
72
72
  # @api private
73
73
  def value
74
- self.value = ::Gem::Version.new "5.8.0" if not @value
74
+ self.value = ::Gem::Version.new "6.0.0" if not @value
75
75
  @value
76
76
  end
77
77
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2016-2019 New Context, Inc.
3
+ # Copyright 2016-2021 Copado NCS LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lane
@@ -62,36 +62,8 @@ cert_chain:
62
62
  JH4yGDzVEYaZHaohSDcYuGLK6OQylPu7oM75S+TNLWseDIT8bWgQk6NelVjtQQ2Q
63
63
  XSbgfu863jyey/0qO01cUo3+iTqzl85cWg==
64
64
  -----END CERTIFICATE-----
65
- date: 2021-05-19 00:00:00.000000000 Z
65
+ date: 2021-07-08 00:00:00.000000000 Z
66
66
  dependencies:
67
- - !ruby/object:Gem::Dependency
68
- name: bundler
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '2.0'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '2.0'
81
- - !ruby/object:Gem::Dependency
82
- name: guard-bundler
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '2.1'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '2.1'
95
67
  - !ruby/object:Gem::Dependency
96
68
  name: guard-rspec
97
69
  requirement: !ruby/object:Gem::Requirement
@@ -204,20 +176,34 @@ dependencies:
204
176
  - - "~>"
205
177
  - !ruby/object:Gem::Version
206
178
  version: '4.2'
179
+ - !ruby/object:Gem::Dependency
180
+ name: rake
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: '13.0'
186
+ type: :development
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - "~>"
191
+ - !ruby/object:Gem::Version
192
+ version: '13.0'
207
193
  - !ruby/object:Gem::Dependency
208
194
  name: rspec
209
195
  requirement: !ruby/object:Gem::Requirement
210
196
  requirements:
211
197
  - - "~>"
212
198
  - !ruby/object:Gem::Version
213
- version: '3.4'
199
+ version: '3.10'
214
200
  type: :development
215
201
  prerelease: false
216
202
  version_requirements: !ruby/object:Gem::Requirement
217
203
  requirements:
218
204
  - - "~>"
219
205
  - !ruby/object:Gem::Version
220
- version: '3.4'
206
+ version: '3.10'
221
207
  - !ruby/object:Gem::Dependency
222
208
  name: rufo
223
209
  requirement: !ruby/object:Gem::Requirement
@@ -289,33 +275,53 @@ dependencies:
289
275
  - !ruby/object:Gem::Version
290
276
  version: 6.0.2
291
277
  - !ruby/object:Gem::Dependency
292
- name: delegate
278
+ name: webrick
293
279
  requirement: !ruby/object:Gem::Requirement
294
280
  requirements:
295
281
  - - "~>"
282
+ - !ruby/object:Gem::Version
283
+ version: '1.7'
284
+ type: :development
285
+ prerelease: false
286
+ version_requirements: !ruby/object:Gem::Requirement
287
+ requirements:
288
+ - - "~>"
289
+ - !ruby/object:Gem::Version
290
+ version: '1.7'
291
+ - !ruby/object:Gem::Dependency
292
+ name: delegate
293
+ requirement: !ruby/object:Gem::Requirement
294
+ requirements:
295
+ - - ">="
296
296
  - !ruby/object:Gem::Version
297
297
  version: 0.1.0
298
+ - - "<"
299
+ - !ruby/object:Gem::Version
300
+ version: 0.3.0
298
301
  type: :runtime
299
302
  prerelease: false
300
303
  version_requirements: !ruby/object:Gem::Requirement
301
304
  requirements:
302
- - - "~>"
305
+ - - ">="
303
306
  - !ruby/object:Gem::Version
304
307
  version: 0.1.0
308
+ - - "<"
309
+ - !ruby/object:Gem::Version
310
+ version: 0.3.0
305
311
  - !ruby/object:Gem::Dependency
306
312
  name: dry-validation
307
313
  requirement: !ruby/object:Gem::Requirement
308
314
  requirements:
309
315
  - - "~>"
310
316
  - !ruby/object:Gem::Version
311
- version: '0.13'
317
+ version: '1.6'
312
318
  type: :runtime
313
319
  prerelease: false
314
320
  version_requirements: !ruby/object:Gem::Requirement
315
321
  requirements:
316
322
  - - "~>"
317
323
  - !ruby/object:Gem::Version
318
- version: '0.13'
324
+ version: '1.6'
319
325
  - !ruby/object:Gem::Dependency
320
326
  name: mixlib-shellout
321
327
  requirement: !ruby/object:Gem::Requirement
@@ -386,16 +392,22 @@ dependencies:
386
392
  name: test-kitchen
387
393
  requirement: !ruby/object:Gem::Requirement
388
394
  requirements:
389
- - - "~>"
395
+ - - ">="
390
396
  - !ruby/object:Gem::Version
391
397
  version: '2.1'
398
+ - - "<"
399
+ - !ruby/object:Gem::Version
400
+ version: '4.0'
392
401
  type: :runtime
393
402
  prerelease: false
394
403
  version_requirements: !ruby/object:Gem::Requirement
395
404
  requirements:
396
- - - "~>"
405
+ - - ">="
397
406
  - !ruby/object:Gem::Version
398
407
  version: '2.1'
408
+ - - "<"
409
+ - !ruby/object:Gem::Version
410
+ version: '4.0'
399
411
  - !ruby/object:Gem::Dependency
400
412
  name: tty-which
401
413
  requirement: !ruby/object:Gem::Requirement
@@ -465,19 +477,18 @@ files:
465
477
  - lib/kitchen/terraform/config_attribute/variables.rb
466
478
  - lib/kitchen/terraform/config_attribute/verify_version.rb
467
479
  - lib/kitchen/terraform/config_attribute_cacher.rb
480
+ - lib/kitchen/terraform/config_attribute_contract.rb
481
+ - lib/kitchen/terraform/config_attribute_contract/array_of_strings.rb
482
+ - lib/kitchen/terraform/config_attribute_contract/boolean.rb
483
+ - lib/kitchen/terraform/config_attribute_contract/hash_of_symbols_and_strings.rb
484
+ - lib/kitchen/terraform/config_attribute_contract/integer.rb
485
+ - lib/kitchen/terraform/config_attribute_contract/optional_string.rb
486
+ - lib/kitchen/terraform/config_attribute_contract/string.rb
487
+ - lib/kitchen/terraform/config_attribute_contract/systems.rb
468
488
  - lib/kitchen/terraform/config_attribute_definer.rb
469
489
  - lib/kitchen/terraform/config_attribute_type.rb
470
490
  - lib/kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings.rb
471
491
  - lib/kitchen/terraform/config_attribute_type/integer.rb
472
- - lib/kitchen/terraform/config_predicates.rb
473
- - lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb
474
- - lib/kitchen/terraform/config_schemas.rb
475
- - lib/kitchen/terraform/config_schemas/array_of_strings.rb
476
- - lib/kitchen/terraform/config_schemas/boolean.rb
477
- - lib/kitchen/terraform/config_schemas/optional_string.rb
478
- - lib/kitchen/terraform/config_schemas/string.rb
479
- - lib/kitchen/terraform/config_schemas/system.rb
480
- - lib/kitchen/terraform/config_schemas/systems.rb
481
492
  - lib/kitchen/terraform/configurable.rb
482
493
  - lib/kitchen/terraform/debug_logger.rb
483
494
  - lib/kitchen/terraform/deprecating.rb
@@ -538,10 +549,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
538
549
  requirements:
539
550
  - - ">="
540
551
  - !ruby/object:Gem::Version
541
- version: '2.4'
552
+ version: '2.6'
542
553
  - - "<"
543
554
  - !ruby/object:Gem::Version
544
- version: '2.8'
555
+ version: '4.0'
545
556
  required_rubygems_version: !ruby/object:Gem::Requirement
546
557
  requirements:
547
558
  - - ">="
metadata.gz.sig CHANGED
Binary file
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2016-2019 New Context, 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/logic"
18
- require "kitchen/terraform/config_predicates"
19
-
20
- # Behaviour to provide a configuration attribute predicate for a hash including only symbol keys and string values.
21
- #
22
- # This module must be declared as providing predicates and extended in a schema's configuration in order to be used.
23
- #
24
- # @see http://dry-rb.org/gems/dry-validation/custom-predicates/ DRY Logic Custom Predicates
25
- module ::Kitchen::Terraform::ConfigPredicates::HashOfSymbolsAndStrings
26
- # A callback to configure an extending schema with this predicate.
27
- #
28
- # @param schema [Dry::Validation::Schema] the schema to be configured.
29
- # @return [self]
30
- def self.extended(schema)
31
- schema.predicates self
32
- self
33
- end
34
-
35
- include ::Dry::Logic::Predicates
36
-
37
- predicate :hash_of_symbols_and_strings? do |value|
38
- value.kind_of? ::Hash and
39
- all_symbols? keys: value.keys and
40
- all_strings? values: value.values
41
- end
42
-
43
- private_class_method
44
-
45
- # If all keys are symbols then the result is +true+; else the result is +false+.
46
- #
47
- # @api private
48
- # @param keys [Enumerable] keys that must be only symbols
49
- # @return [TrueClass, ::FalseClass] the result
50
- def self.all_symbols?(keys:)
51
- keys
52
- .all? do |key|
53
- key.kind_of? ::Symbol
54
- end
55
- end
56
-
57
- # If all values are strings then the result is +true+; else the result is +false+.
58
- #
59
- # @api private
60
- # @param values [Enumerable] values that must be only strings
61
- # @return [TrueClass, ::FalseClass] the result
62
- def self.all_strings?(values:)
63
- values
64
- .all? do |value|
65
- value.kind_of? ::String
66
- end
67
- end
68
-
69
- private
70
-
71
- def messages
72
- super
73
- .merge(
74
- en: {
75
- errors: {
76
- hash_of_symbols_and_strings?: "must be a hash which includes only symbol keys and string values",
77
- },
78
- },
79
- )
80
- end
81
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2016-2019 New Context, 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
-
19
- module Kitchen
20
- module Terraform
21
- module ConfigSchemas
22
- # A validation schema for a configuration attribute which is an array including only strings.
23
- #
24
- # @see http://dry-rb.org/gems/dry-validation/basics/working-with-schemas/ DRY Validation Working With Schemas
25
- ArrayOfStrings = ::Dry::Validation.Schema do
26
- required(:value)
27
- .each(
28
- :filled?,
29
- :str?
30
- )
31
- end.dup
32
-
33
- ArrayOfStrings.define_singleton_method :to_s do
34
- "Kitchen::Terraform::ConfigSchemas::ArrayOfStrings"
35
- end
36
- end
37
- end
38
- end