sfn 3.0.30 → 3.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/sfn +16 -14
  4. data/lib/chef/knife/knife_plugin_seed.rb +12 -12
  5. data/lib/sfn.rb +17 -17
  6. data/lib/sfn/api_provider.rb +3 -3
  7. data/lib/sfn/api_provider/google.rb +2 -2
  8. data/lib/sfn/api_provider/terraform.rb +2 -2
  9. data/lib/sfn/cache.rb +9 -9
  10. data/lib/sfn/callback.rb +6 -6
  11. data/lib/sfn/callback/aws_assume_role.rb +5 -5
  12. data/lib/sfn/callback/aws_mfa.rb +8 -6
  13. data/lib/sfn/callback/stack_policy.rb +15 -15
  14. data/lib/sfn/command.rb +37 -36
  15. data/lib/sfn/command/conf.rb +12 -12
  16. data/lib/sfn/command/create.rb +9 -9
  17. data/lib/sfn/command/describe.rb +6 -6
  18. data/lib/sfn/command/destroy.rb +8 -8
  19. data/lib/sfn/command/diff.rb +31 -31
  20. data/lib/sfn/command/events.rb +6 -6
  21. data/lib/sfn/command/export.rb +8 -8
  22. data/lib/sfn/command/graph.rb +21 -21
  23. data/lib/sfn/command/graph/aws.rb +34 -34
  24. data/lib/sfn/command/graph/provider.rb +1 -1
  25. data/lib/sfn/command/graph/terraform.rb +41 -41
  26. data/lib/sfn/command/import.rb +17 -17
  27. data/lib/sfn/command/init.rb +15 -15
  28. data/lib/sfn/command/inspect.rb +16 -16
  29. data/lib/sfn/command/lint.rb +6 -6
  30. data/lib/sfn/command/list.rb +2 -2
  31. data/lib/sfn/command/plan.rb +227 -0
  32. data/lib/sfn/command/print.rb +4 -4
  33. data/lib/sfn/command/promote.rb +2 -2
  34. data/lib/sfn/command/update.rb +19 -144
  35. data/lib/sfn/command/validate.rb +17 -13
  36. data/lib/sfn/command_module.rb +6 -5
  37. data/lib/sfn/command_module/base.rb +8 -8
  38. data/lib/sfn/command_module/callbacks.rb +5 -5
  39. data/lib/sfn/command_module/planning.rb +151 -0
  40. data/lib/sfn/command_module/stack.rb +34 -34
  41. data/lib/sfn/command_module/template.rb +50 -50
  42. data/lib/sfn/config.rb +46 -44
  43. data/lib/sfn/config/conf.rb +3 -3
  44. data/lib/sfn/config/create.rb +9 -9
  45. data/lib/sfn/config/describe.rb +7 -7
  46. data/lib/sfn/config/destroy.rb +1 -1
  47. data/lib/sfn/config/diff.rb +3 -3
  48. data/lib/sfn/config/events.rb +9 -9
  49. data/lib/sfn/config/export.rb +5 -5
  50. data/lib/sfn/config/graph.rb +10 -10
  51. data/lib/sfn/config/import.rb +4 -4
  52. data/lib/sfn/config/init.rb +1 -1
  53. data/lib/sfn/config/inspect.rb +16 -16
  54. data/lib/sfn/config/lint.rb +5 -5
  55. data/lib/sfn/config/list.rb +6 -6
  56. data/lib/sfn/config/plan.rb +28 -0
  57. data/lib/sfn/config/print.rb +5 -5
  58. data/lib/sfn/config/promote.rb +4 -4
  59. data/lib/sfn/config/update.rb +18 -18
  60. data/lib/sfn/config/validate.rb +30 -30
  61. data/lib/sfn/lint.rb +5 -5
  62. data/lib/sfn/lint/definition.rb +3 -3
  63. data/lib/sfn/lint/rule.rb +3 -3
  64. data/lib/sfn/lint/rule_set.rb +2 -2
  65. data/lib/sfn/monkey_patch.rb +2 -2
  66. data/lib/sfn/monkey_patch/stack.rb +27 -27
  67. data/lib/sfn/monkey_patch/stack/azure.rb +1 -1
  68. data/lib/sfn/monkey_patch/stack/google.rb +5 -5
  69. data/lib/sfn/planner.rb +4 -4
  70. data/lib/sfn/planner/aws.rb +114 -70
  71. data/lib/sfn/provider.rb +13 -13
  72. data/lib/sfn/utils.rb +10 -10
  73. data/lib/sfn/utils/debug.rb +2 -2
  74. data/lib/sfn/utils/json.rb +1 -1
  75. data/lib/sfn/utils/object_storage.rb +3 -3
  76. data/lib/sfn/utils/output.rb +4 -4
  77. data/lib/sfn/utils/path_selector.rb +15 -15
  78. data/lib/sfn/utils/ssher.rb +4 -4
  79. data/lib/sfn/utils/stack_exporter.rb +16 -16
  80. data/lib/sfn/utils/stack_parameter_scrubber.rb +6 -6
  81. data/lib/sfn/utils/stack_parameter_validator.rb +22 -22
  82. data/lib/sfn/version.rb +1 -1
  83. data/sfn.gemspec +32 -32
  84. metadata +16 -13
@@ -1,5 +1,5 @@
1
- require 'sfn'
2
- require 'bogo-config'
1
+ require "sfn"
2
+ require "bogo-config"
3
3
 
4
4
  module Sfn
5
5
 
@@ -30,82 +30,83 @@ module Sfn
30
30
  v
31
31
  end
32
32
  end
33
- info[:description] ||= ''
34
- info[:description] << ' (Key:Value[,Key:Value,...])'
33
+ info[:description] ||= ""
34
+ info[:description] << " (Key:Value[,Key:Value,...])"
35
35
  end
36
36
  end
37
37
  super(name, type, info)
38
38
  end
39
39
 
40
40
  # Only values allowed designating bool type
41
- BOOLEAN_VALUES = [TrueClass, FalseClass]
41
+ BOOLEAN = BOOLEAN_VALUES = [TrueClass, FalseClass]
42
42
 
43
- autoload :Conf, 'sfn/config/conf'
44
- autoload :Create, 'sfn/config/create'
45
- autoload :Describe, 'sfn/config/describe'
46
- autoload :Destroy, 'sfn/config/destroy'
47
- autoload :Describe, 'sfn/config/describe'
48
- autoload :Diff, 'sfn/config/diff'
49
- autoload :Events, 'sfn/config/events'
50
- autoload :Export, 'sfn/config/export'
51
- autoload :Graph, 'sfn/config/graph'
52
- autoload :Import, 'sfn/config/import'
53
- autoload :Init, 'sfn/config/init'
54
- autoload :Inspect, 'sfn/config/inspect'
55
- autoload :Lint, 'sfn/config/lint'
56
- autoload :List, 'sfn/config/list'
57
- autoload :Print, 'sfn/config/print'
58
- autoload :Promote, 'sfn/config/promote'
59
- autoload :Update, 'sfn/config/update'
60
- autoload :Validate, 'sfn/config/validate'
43
+ autoload :Conf, "sfn/config/conf"
44
+ autoload :Create, "sfn/config/create"
45
+ autoload :Describe, "sfn/config/describe"
46
+ autoload :Destroy, "sfn/config/destroy"
47
+ autoload :Describe, "sfn/config/describe"
48
+ autoload :Diff, "sfn/config/diff"
49
+ autoload :Events, "sfn/config/events"
50
+ autoload :Export, "sfn/config/export"
51
+ autoload :Graph, "sfn/config/graph"
52
+ autoload :Import, "sfn/config/import"
53
+ autoload :Init, "sfn/config/init"
54
+ autoload :Inspect, "sfn/config/inspect"
55
+ autoload :Lint, "sfn/config/lint"
56
+ autoload :List, "sfn/config/list"
57
+ autoload :Plan, "sfn/config/plan"
58
+ autoload :Print, "sfn/config/print"
59
+ autoload :Promote, "sfn/config/promote"
60
+ autoload :Update, "sfn/config/update"
61
+ autoload :Validate, "sfn/config/validate"
61
62
 
62
63
  attribute(
63
64
  :config, String,
64
- :description => 'Configuration file path',
65
- :short_flag => 'c',
65
+ :description => "Configuration file path",
66
+ :short_flag => "c",
66
67
  )
67
68
 
68
69
  attribute(
69
70
  :credentials, Smash,
70
- :description => 'Provider credentials',
71
- :short_flag => 'C',
71
+ :description => "Provider credentials",
72
+ :short_flag => "C",
72
73
  )
73
74
  attribute(
74
75
  :ignore_parameters, String,
75
76
  :multiple => true,
76
- :description => 'Parameters to ignore during modifications',
77
- :short_flag => 'i',
77
+ :description => "Parameters to ignore during modifications",
78
+ :short_flag => "i",
78
79
  )
79
80
  attribute(
80
81
  :interactive_parameters, [TrueClass, FalseClass],
81
82
  :default => true,
82
- :description => 'Prompt for template parameters',
83
- :short_flag => 'I',
83
+ :description => "Prompt for template parameters",
84
+ :short_flag => "I",
84
85
  )
85
86
  attribute(
86
87
  :poll, [TrueClass, FalseClass],
87
88
  :default => true,
88
- :description => 'Poll stack events on modification actions',
89
- :short_flag => 'p',
89
+ :description => "Poll stack events on modification actions",
90
+ :short_flag => "p",
90
91
  )
91
92
  attribute(
92
93
  :defaults, [TrueClass, FalseClass],
93
- :description => 'Automatically accept default values',
94
- :short_flag => 'd',
94
+ :description => "Automatically accept default values",
95
+ :short_flag => "d",
95
96
  )
96
97
  attribute(
97
98
  :yes, [TrueClass, FalseClass],
98
- :description => 'Automatically accept any requests for confirmation',
99
- :short_flag => 'y',
99
+ :description => "Automatically accept any requests for confirmation",
100
+ :short_flag => "y",
100
101
  )
101
102
  attribute(
102
103
  :debug, [TrueClass, FalseClass],
103
- :description => 'Enable debug output',
104
- :short_flag => 'u',
104
+ :description => "Enable debug output",
105
+ :short_flag => "u",
105
106
  )
106
107
  attribute(
107
108
  :colors, [TrueClass, FalseClass],
108
- :description => 'Enable colorized output',
109
+ :description => "Enable colorized output",
109
110
  :default => true,
110
111
  )
111
112
 
@@ -127,7 +128,7 @@ module Sfn
127
128
  # @param klass [Class]
128
129
  # @return [Smash]
129
130
  def self.options_for(klass)
130
- shorts = ['h'] # always reserve `-h` for help
131
+ shorts = ["h"] # always reserve `-h` for help
131
132
  _options_for(klass, shorts)
132
133
  end
133
134
 
@@ -137,8 +138,8 @@ module Sfn
137
138
  # @param shorts [Array<String>]
138
139
  # @return [Smash]
139
140
  def self._options_for(klass, shorts)
140
- Smash[
141
- ([klass] + klass.ancestors).map do |a|
141
+ opts = Smash[
142
+ [klass].map do |a|
142
143
  if a.ancestors.include?(Bogo::Config) && !a.attributes.empty?
143
144
  a.attributes
144
145
  end
@@ -152,11 +153,12 @@ module Sfn
152
153
  shorts << short
153
154
  info[:short] = short
154
155
  end
155
- info[:long] = name.tr('_', '-')
156
+ info[:long] = name.tr("_", "-")
156
157
  info[:boolean] = [info[:type]].compact.flatten.all? { |t| BOOLEAN_VALUES.include?(t) }
157
158
  [name, info]
158
159
  end.compact
159
160
  ]
161
+ opts
160
162
  end
161
163
  end
162
164
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -6,8 +6,8 @@ module Sfn
6
6
  class Conf < Create
7
7
  attribute(
8
8
  :generate, [TrueClass, FalseClass],
9
- :description => 'Generate a basic configuration file',
10
- :short_flag => 'g',
9
+ :description => "Generate a basic configuration file",
10
+ :short_flag => "g",
11
11
  )
12
12
  end
13
13
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,24 +7,24 @@ module Sfn
7
7
  attribute(
8
8
  :timeout, Integer,
9
9
  :coerce => proc { |v| v.to_i },
10
- :description => 'Seconds to wait for stack to complete',
11
- :short_flag => 'M',
10
+ :description => "Seconds to wait for stack to complete",
11
+ :short_flag => "M",
12
12
  )
13
13
  attribute(
14
14
  :rollback, [TrueClass, FalseClass],
15
- :description => 'Rollback stack on failure',
16
- :short_flag => 'O',
15
+ :description => "Rollback stack on failure",
16
+ :short_flag => "O",
17
17
  )
18
18
  attribute(
19
19
  :options, Smash,
20
- :description => 'Extra options to apply to the API call',
21
- :short_flag => 'S',
20
+ :description => "Extra options to apply to the API call",
21
+ :short_flag => "S",
22
22
  )
23
23
  attribute(
24
24
  :notification_topics, String,
25
25
  :multiple => true,
26
- :description => 'Notification endpoints for stack events',
27
- :short_flag => 'z',
26
+ :description => "Notification endpoints for stack events",
27
+ :short_flag => "z",
28
28
  )
29
29
  end
30
30
  end
@@ -1,24 +1,24 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
5
5
  class Describe < Config
6
6
  attribute(
7
7
  :resources, [TrueClass, FalseClass],
8
- :description => 'Display stack resource list',
9
- :short_flag => 'r',
8
+ :description => "Display stack resource list",
9
+ :short_flag => "r",
10
10
  )
11
11
 
12
12
  attribute(
13
13
  :outputs, [TrueClass, FalseClass],
14
- :description => 'Display stack outputs',
15
- :short_flag => 'o',
14
+ :description => "Display stack outputs",
15
+ :short_flag => "o",
16
16
  )
17
17
 
18
18
  attribute(
19
19
  :tags, [TrueClass, FalseClass],
20
- :description => 'Display stack tags',
21
- :short_flag => 't',
20
+ :description => "Display stack tags",
21
+ :short_flag => "t",
22
22
  )
23
23
  end
24
24
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,8 +7,8 @@ module Sfn
7
7
  attribute(
8
8
  :raw_diff, [TrueClass, FalseClass],
9
9
  :default => false,
10
- :description => 'Display raw diff information',
11
- :short_flag => 'w',
10
+ :description => "Display raw diff information",
11
+ :short_flag => "w",
12
12
  )
13
13
  end
14
14
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,25 +7,25 @@ module Sfn
7
7
  attribute(
8
8
  :attribute, String,
9
9
  :multiple => true,
10
- :description => 'Event attribute to display',
11
- :short_flag => 'a',
10
+ :description => "Event attribute to display",
11
+ :short_flag => "a",
12
12
  )
13
13
  attribute(
14
14
  :poll_delay, Integer,
15
15
  :default => 20,
16
- :description => 'Seconds to pause between each event poll',
16
+ :description => "Seconds to pause between each event poll",
17
17
  :coerce => lambda { |v| v.to_i },
18
- :short_flag => 'P',
18
+ :short_flag => "P",
19
19
  )
20
20
  attribute(
21
21
  :all_attributes, [TrueClass, FalseClass],
22
- :description => 'Display all event attributes',
23
- :short_flag => 'A',
22
+ :description => "Display all event attributes",
23
+ :short_flag => "A",
24
24
  )
25
25
  attribute(
26
26
  :all_events, [TrueClass, FalseClass],
27
- :description => 'Display all available events',
28
- :short_flag => 'L',
27
+ :description => "Display all available events",
28
+ :short_flag => "L",
29
29
  )
30
30
  end
31
31
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,19 +7,19 @@ module Sfn
7
7
  class Export < Config
8
8
  attribute(
9
9
  :name, String,
10
- :description => 'Export file base name',
10
+ :description => "Export file base name",
11
11
  )
12
12
  attribute(
13
13
  :path, String,
14
- :description => 'Local path prefix for dump file',
14
+ :description => "Local path prefix for dump file",
15
15
  )
16
16
  attribute(
17
17
  :bucket, String,
18
- :description => 'Remote storage bucket',
18
+ :description => "Remote storage bucket",
19
19
  )
20
20
  attribute(
21
21
  :bucket_prefix, String,
22
- :description => 'Remote key prefix within bucket for dump file',
22
+ :description => "Remote key prefix within bucket for dump file",
23
23
  )
24
24
  end
25
25
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -6,27 +6,27 @@ module Sfn
6
6
  class Graph < Validate
7
7
  attribute(
8
8
  :output_file, String,
9
- :description => 'Directory to write graph files',
10
- :short_flag => 'O',
11
- :default => File.join(Dir.pwd, 'sfn-graph'),
9
+ :description => "Directory to write graph files",
10
+ :short_flag => "O",
11
+ :default => File.join(Dir.pwd, "sfn-graph"),
12
12
  )
13
13
 
14
14
  attribute(
15
15
  :output_type, String,
16
- :description => 'File output type (Requires graphviz package for non-dot types)',
17
- :short_flag => 'e',
18
- :default => 'dot',
16
+ :description => "File output type (Requires graphviz package for non-dot types)",
17
+ :short_flag => "e",
18
+ :default => "dot",
19
19
  )
20
20
 
21
21
  attribute(
22
22
  :graph_style, String,
23
- :description => 'Style of graph (`dependency`, `creation`)',
24
- :default => 'creation',
23
+ :description => "Style of graph (`dependency`, `creation`)",
24
+ :default => "creation",
25
25
  )
26
26
 
27
27
  attribute(
28
28
  :luckymike, [TrueClass, FalseClass],
29
- :description => 'Force `dependency` style graph',
29
+ :description => "Force `dependency` style graph",
30
30
  :default => false,
31
31
  )
32
32
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,15 +7,15 @@ module Sfn
7
7
  class Import < Config
8
8
  attribute(
9
9
  :path, String,
10
- :description => 'Directory path JSON export files are located',
10
+ :description => "Directory path JSON export files are located",
11
11
  )
12
12
  attribute(
13
13
  :bucket, String,
14
- :description => 'Remote storage bucket JSON export files are located',
14
+ :description => "Remote storage bucket JSON export files are located",
15
15
  )
16
16
  attribute(
17
17
  :bucket_prefix, String,
18
- :description => 'Remote key prefix within bucket for dump file',
18
+ :description => "Remote key prefix within bucket for dump file",
19
19
  )
20
20
  end
21
21
  end
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -1,4 +1,4 @@
1
- require 'sfn'
1
+ require "sfn"
2
2
 
3
3
  module Sfn
4
4
  class Config
@@ -7,39 +7,39 @@ module Sfn
7
7
  attribute(
8
8
  :attribute, String,
9
9
  :multiple => true,
10
- :description => 'Dot delimited attribute to view',
11
- :short_flag => 'a',
10
+ :description => "Dot delimited attribute to view",
11
+ :short_flag => "a",
12
12
  )
13
13
  attribute(
14
14
  :nodes, [TrueClass, FalseClass],
15
- :description => 'Locate all instances and display addresses',
16
- :short_flag => 'n',
15
+ :description => "Locate all instances and display addresses",
16
+ :short_flag => "n",
17
17
  )
18
18
  attribute(
19
19
  :load_balancers, [TrueClass, FalseClass],
20
- :description => 'Locate all load balancers, display addresses and server states',
21
- :short_flag => 'l',
20
+ :description => "Locate all load balancers, display addresses and server states",
21
+ :short_flag => "l",
22
22
  )
23
23
  attribute(
24
24
  :instance_failure, [TrueClass, FalseClass],
25
- :description => 'Display log file error from failed not if possible',
26
- :short_flag => 'N',
25
+ :description => "Display log file error from failed not if possible",
26
+ :short_flag => "N",
27
27
  )
28
28
  attribute(
29
29
  :failure_log_path, String,
30
- :description => 'Path to remote log file for display on failure',
31
- :default => '/var/log/chef/client.log',
32
- :short_flag => 'f',
30
+ :description => "Path to remote log file for display on failure",
31
+ :default => "/var/log/chef/client.log",
32
+ :short_flag => "f",
33
33
  )
34
34
  attribute(
35
35
  :identity_file, String,
36
- :description => 'SSH identity file for authentication',
37
- :short_flag => 'D',
36
+ :description => "SSH identity file for authentication",
37
+ :short_flag => "D",
38
38
  )
39
39
  attribute(
40
40
  :ssh_user, String,
41
- :description => 'SSH username for inspection connect',
42
- :short_flag => 's',
41
+ :description => "SSH username for inspection connect",
42
+ :short_flag => "s",
43
43
  )
44
44
  end
45
45
  end