sfn 3.0.28 → 3.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5 -0
  3. data/docs/callbacks.md +1 -0
  4. data/lib/chef/knife/knife_plugin_seed.rb +11 -17
  5. data/lib/sfn.rb +0 -2
  6. data/lib/sfn/api_provider.rb +0 -2
  7. data/lib/sfn/api_provider/google.rb +6 -9
  8. data/lib/sfn/api_provider/terraform.rb +4 -6
  9. data/lib/sfn/cache.rb +36 -39
  10. data/lib/sfn/callback.rb +0 -2
  11. data/lib/sfn/callback/aws_assume_role.rb +7 -8
  12. data/lib/sfn/callback/aws_mfa.rb +7 -8
  13. data/lib/sfn/callback/stack_policy.rb +15 -17
  14. data/lib/sfn/command.rb +9 -11
  15. data/lib/sfn/command/conf.rb +7 -10
  16. data/lib/sfn/command/create.rb +8 -12
  17. data/lib/sfn/command/describe.rb +6 -8
  18. data/lib/sfn/command/destroy.rb +8 -10
  19. data/lib/sfn/command/diff.rb +18 -25
  20. data/lib/sfn/command/events.rb +15 -16
  21. data/lib/sfn/command/export.rb +13 -17
  22. data/lib/sfn/command/graph.rb +11 -13
  23. data/lib/sfn/command/graph/aws.rb +27 -29
  24. data/lib/sfn/command/graph/terraform.rb +22 -23
  25. data/lib/sfn/command/import.rb +13 -16
  26. data/lib/sfn/command/init.rb +5 -7
  27. data/lib/sfn/command/inspect.rb +26 -29
  28. data/lib/sfn/command/lint.rb +10 -12
  29. data/lib/sfn/command/list.rb +5 -8
  30. data/lib/sfn/command/print.rb +3 -5
  31. data/lib/sfn/command/promote.rb +0 -2
  32. data/lib/sfn/command/update.rb +42 -46
  33. data/lib/sfn/command/validate.rb +4 -6
  34. data/lib/sfn/command_module/base.rb +17 -25
  35. data/lib/sfn/command_module/callbacks.rb +12 -8
  36. data/lib/sfn/command_module/stack.rb +39 -43
  37. data/lib/sfn/command_module/template.rb +89 -90
  38. data/lib/sfn/config.rb +30 -31
  39. data/lib/sfn/config/conf.rb +1 -3
  40. data/lib/sfn/config/create.rb +5 -7
  41. data/lib/sfn/config/describe.rb +3 -5
  42. data/lib/sfn/config/diff.rb +1 -1
  43. data/lib/sfn/config/events.rb +6 -8
  44. data/lib/sfn/config/export.rb +4 -7
  45. data/lib/sfn/config/graph.rb +4 -6
  46. data/lib/sfn/config/import.rb +3 -5
  47. data/lib/sfn/config/init.rb +0 -1
  48. data/lib/sfn/config/inspect.rb +7 -9
  49. data/lib/sfn/config/lint.rb +4 -4
  50. data/lib/sfn/config/list.rb +3 -5
  51. data/lib/sfn/config/print.rb +3 -5
  52. data/lib/sfn/config/promote.rb +3 -5
  53. data/lib/sfn/config/update.rb +10 -12
  54. data/lib/sfn/config/validate.rb +18 -20
  55. data/lib/sfn/lint.rb +0 -2
  56. data/lib/sfn/lint/definition.rb +3 -5
  57. data/lib/sfn/lint/rule.rb +7 -8
  58. data/lib/sfn/lint/rule_set.rb +11 -20
  59. data/lib/sfn/monkey_patch/stack.rb +32 -34
  60. data/lib/sfn/monkey_patch/stack/azure.rb +0 -1
  61. data/lib/sfn/monkey_patch/stack/google.rb +15 -16
  62. data/lib/sfn/planner.rb +1 -3
  63. data/lib/sfn/planner/aws.rb +82 -89
  64. data/lib/sfn/provider.rb +21 -23
  65. data/lib/sfn/utils.rb +0 -2
  66. data/lib/sfn/utils/debug.rb +1 -2
  67. data/lib/sfn/utils/json.rb +3 -2
  68. data/lib/sfn/utils/object_storage.rb +1 -2
  69. data/lib/sfn/utils/output.rb +8 -9
  70. data/lib/sfn/utils/path_selector.rb +9 -10
  71. data/lib/sfn/utils/ssher.rb +2 -3
  72. data/lib/sfn/utils/stack_exporter.rb +20 -21
  73. data/lib/sfn/utils/stack_parameter_scrubber.rb +6 -7
  74. data/lib/sfn/utils/stack_parameter_validator.rb +14 -16
  75. data/lib/sfn/version.rb +1 -1
  76. data/sfn.gemspec +1 -1
  77. metadata +8 -8
@@ -6,11 +6,11 @@ module Sfn
6
6
  module StackParameterScrubber
7
7
 
8
8
  # Validate attributes within Parameter blocks
9
- ALLOWED_PARAMETER_ATTRIBUTES = %w(
10
- Type Default NoEcho AllowedValues AllowedPattern
11
- MaxLength MinLength MaxValue MinValue Description
12
- ConstraintDescription
13
- )
9
+ ALLOWED_PARAMETER_ATTRIBUTES = [
10
+ 'Type', 'Default', 'NoEcho', 'AllowedValues', 'AllowedPattern',
11
+ 'MaxLength', 'MinLength', 'MaxValue', 'MinValue', 'Description',
12
+ 'ConstraintDescription',
13
+ ]
14
14
 
15
15
  # Clean the parameters of the template
16
16
  #
@@ -18,7 +18,7 @@ module Sfn
18
18
  # @return [Hash] template
19
19
  def parameter_scrub!(template)
20
20
  parameters = template['Parameters']
21
- if(parameters)
21
+ if parameters
22
22
  parameters.each do |name, options|
23
23
  options.delete_if do |attribute, value|
24
24
  !ALLOWED_PARAMETER_ATTRIBUTES.include?(attribute)
@@ -28,7 +28,6 @@ module Sfn
28
28
  end
29
29
  template
30
30
  end
31
-
32
31
  end
33
32
  end
34
33
  end
@@ -5,7 +5,6 @@ module Sfn
5
5
 
6
6
  # Helper utility for validating stack parameters
7
7
  module StackParameterValidator
8
-
9
8
  include Bogo::AnimalStrings
10
9
 
11
10
  # HOT parameter mapping
@@ -15,19 +14,19 @@ module Sfn
15
14
  'MaxValue' => [:range, :max],
16
15
  'MinValue' => [:range, :min],
17
16
  'AllowedValues' => [:allowed_values],
18
- 'AllowedPattern' => [:allowed_pattern]
17
+ 'AllowedPattern' => [:allowed_pattern],
19
18
  }
20
19
 
21
20
  # GCDM parameter mapping
22
21
  GOOGLE_CONSTRAINT_MAP = {
23
22
  'AllowedPattern' => [:pattern],
24
23
  'MaxValue' => [:maximum],
25
- 'MinValue' => [:minimum]
24
+ 'MinValue' => [:minimum],
26
25
  }
27
26
 
28
27
  # Parameter mapping identifier and content
29
28
  PARAMETER_DEFINITION_MAP = {
30
- 'constraints' => HEAT_CONSTRAINT_MAP
29
+ 'constraints' => HEAT_CONSTRAINT_MAP,
31
30
  }
32
31
 
33
32
  # Supported parameter validations
@@ -37,7 +36,7 @@ module Sfn
37
36
  'max_length',
38
37
  'min_length',
39
38
  'max_value',
40
- 'min_value'
39
+ 'min_value',
41
40
  ]
42
41
 
43
42
  # Validate a parameters
@@ -59,7 +58,7 @@ module Sfn
59
58
  valid_key = parameter_definition.keys.detect do |pdef_key|
60
59
  pdef_key.downcase.gsub('_', '') == validator_key.downcase.gsub('_', '')
61
60
  end
62
- if(valid_key)
61
+ if valid_key
63
62
  value_list.map do |value|
64
63
  res = self.send(validator_key, value, parameter_definition[valid_key])
65
64
  res == true ? true : [validator_key, res]
@@ -68,7 +67,7 @@ module Sfn
68
67
  true
69
68
  end
70
69
  end.flatten(1)
71
- result.delete_if{|x| x == true}
70
+ result.delete_if { |x| x == true }
72
71
  result.empty? ? true : result
73
72
  end
74
73
 
@@ -81,10 +80,10 @@ module Sfn
81
80
  def reformat_definition(pdef)
82
81
  new_def = pdef
83
82
  PARAMETER_DEFINITION_MAP.each do |ident, mapping|
84
- if(pdef[ident])
83
+ if pdef[ident]
85
84
  new_def = Smash.new
86
85
  mapping.each do |new_key, current_path|
87
- if(pdef.get(*current_path))
86
+ if pdef.get(*current_path)
88
87
  new_def[new_key] = pdef.get(*current_path)
89
88
  end
90
89
  end
@@ -100,7 +99,7 @@ module Sfn
100
99
  # @option pdef [Array<String>] 'AllowedValues'
101
100
  # @return [TrueClass, String]
102
101
  def allowed_values(value, pdef)
103
- if(pdef.include?(value))
102
+ if pdef.include?(value)
104
103
  true
105
104
  else
106
105
  "Not an allowed value: #{pdef.join(', ')}"
@@ -114,7 +113,7 @@ module Sfn
114
113
  # @option pdef [String] 'AllowedPattern'
115
114
  # @return [TrueClass, String]
116
115
  def allowed_pattern(value, pdef)
117
- if(value.match(%r{#{pdef}}))
116
+ if value.match(%r{#{pdef}})
118
117
  true
119
118
  else
120
119
  "Not a valid pattern. Must match: #{pdef}"
@@ -128,7 +127,7 @@ module Sfn
128
127
  # @option pdef [String] 'MaxLength'
129
128
  # @return [TrueClass, String]
130
129
  def max_length(value, pdef)
131
- if(value.length <= pdef.to_i)
130
+ if value.length <= pdef.to_i
132
131
  true
133
132
  else
134
133
  "Value must not exceed #{pdef} characters"
@@ -142,7 +141,7 @@ module Sfn
142
141
  # @option pdef [String] 'MinLength'
143
142
  # @return [TrueClass, String]
144
143
  def min_length(value, pdef)
145
- if(value.length >= pdef.to_i)
144
+ if value.length >= pdef.to_i
146
145
  true
147
146
  else
148
147
  "Value must be at least #{pdef} characters"
@@ -156,7 +155,7 @@ module Sfn
156
155
  # @option pdef [String] 'MaxValue'
157
156
  # @return [TrueClass, String]
158
157
  def max_value(value, pdef)
159
- if(value.to_i <= pdef.to_i)
158
+ if value.to_i <= pdef.to_i
160
159
  true
161
160
  else
162
161
  "Value must not be greater than #{pdef}"
@@ -170,7 +169,7 @@ module Sfn
170
169
  # @option pdef [String] 'MinValue'
171
170
  # @return [TrueClass, String]
172
171
  def min_value(value, pdef)
173
- if(value.to_i >= pdef.to_i)
172
+ if value.to_i >= pdef.to_i
174
173
  true
175
174
  else
176
175
  "Value must not be less than #{pdef}"
@@ -185,7 +184,6 @@ module Sfn
185
184
  type = type.downcase
186
185
  type.start_with?('comma') || type.start_with?('list<')
187
186
  end
188
-
189
187
  end
190
188
  end
191
189
  end
@@ -1,4 +1,4 @@
1
1
  module Sfn
2
2
  # Current library version
3
- VERSION = Gem::Version.new('3.0.28')
3
+ VERSION = Gem::Version.new('3.0.30')
4
4
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency 'rake', '~> 10'
28
28
  s.add_development_dependency 'minitest'
29
29
  s.add_development_dependency 'rspec', '~> 3.5'
30
- s.add_development_dependency 'rubocop', '0.38.0'
30
+ s.add_development_dependency 'rufo'
31
31
  s.add_development_dependency 'mocha'
32
32
  s.add_development_dependency 'yard'
33
33
  s.executables << 'sfn'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.28
4
+ version: 3.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-09 00:00:00.000000000 Z
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli
@@ -309,19 +309,19 @@ dependencies:
309
309
  - !ruby/object:Gem::Version
310
310
  version: '3.5'
311
311
  - !ruby/object:Gem::Dependency
312
- name: rubocop
312
+ name: rufo
313
313
  requirement: !ruby/object:Gem::Requirement
314
314
  requirements:
315
- - - '='
315
+ - - ">="
316
316
  - !ruby/object:Gem::Version
317
- version: 0.38.0
317
+ version: '0'
318
318
  type: :development
319
319
  prerelease: false
320
320
  version_requirements: !ruby/object:Gem::Requirement
321
321
  requirements:
322
- - - '='
322
+ - - ">="
323
323
  - !ruby/object:Gem::Version
324
- version: 0.38.0
324
+ version: '0'
325
325
  - !ruby/object:Gem::Dependency
326
326
  name: mocha
327
327
  requirement: !ruby/object:Gem::Requirement
@@ -487,7 +487,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
487
487
  version: '0'
488
488
  requirements: []
489
489
  rubyforge_project:
490
- rubygems_version: 2.6.11
490
+ rubygems_version: 2.7.3
491
491
  signing_key:
492
492
  specification_version: 4
493
493
  summary: SparkleFormation CLI