sfn 3.0.30 → 3.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bin/sfn +16 -14
- data/lib/chef/knife/knife_plugin_seed.rb +12 -12
- data/lib/sfn.rb +17 -17
- data/lib/sfn/api_provider.rb +3 -3
- data/lib/sfn/api_provider/google.rb +2 -2
- data/lib/sfn/api_provider/terraform.rb +2 -2
- data/lib/sfn/cache.rb +9 -9
- data/lib/sfn/callback.rb +6 -6
- data/lib/sfn/callback/aws_assume_role.rb +5 -5
- data/lib/sfn/callback/aws_mfa.rb +8 -6
- data/lib/sfn/callback/stack_policy.rb +15 -15
- data/lib/sfn/command.rb +37 -36
- data/lib/sfn/command/conf.rb +12 -12
- data/lib/sfn/command/create.rb +9 -9
- data/lib/sfn/command/describe.rb +6 -6
- data/lib/sfn/command/destroy.rb +8 -8
- data/lib/sfn/command/diff.rb +31 -31
- data/lib/sfn/command/events.rb +6 -6
- data/lib/sfn/command/export.rb +8 -8
- data/lib/sfn/command/graph.rb +21 -21
- data/lib/sfn/command/graph/aws.rb +34 -34
- data/lib/sfn/command/graph/provider.rb +1 -1
- data/lib/sfn/command/graph/terraform.rb +41 -41
- data/lib/sfn/command/import.rb +17 -17
- data/lib/sfn/command/init.rb +15 -15
- data/lib/sfn/command/inspect.rb +16 -16
- data/lib/sfn/command/lint.rb +6 -6
- data/lib/sfn/command/list.rb +2 -2
- data/lib/sfn/command/plan.rb +227 -0
- data/lib/sfn/command/print.rb +4 -4
- data/lib/sfn/command/promote.rb +2 -2
- data/lib/sfn/command/update.rb +19 -144
- data/lib/sfn/command/validate.rb +17 -13
- data/lib/sfn/command_module.rb +6 -5
- data/lib/sfn/command_module/base.rb +8 -8
- data/lib/sfn/command_module/callbacks.rb +5 -5
- data/lib/sfn/command_module/planning.rb +151 -0
- data/lib/sfn/command_module/stack.rb +34 -34
- data/lib/sfn/command_module/template.rb +50 -50
- data/lib/sfn/config.rb +46 -44
- data/lib/sfn/config/conf.rb +3 -3
- data/lib/sfn/config/create.rb +9 -9
- data/lib/sfn/config/describe.rb +7 -7
- data/lib/sfn/config/destroy.rb +1 -1
- data/lib/sfn/config/diff.rb +3 -3
- data/lib/sfn/config/events.rb +9 -9
- data/lib/sfn/config/export.rb +5 -5
- data/lib/sfn/config/graph.rb +10 -10
- data/lib/sfn/config/import.rb +4 -4
- data/lib/sfn/config/init.rb +1 -1
- data/lib/sfn/config/inspect.rb +16 -16
- data/lib/sfn/config/lint.rb +5 -5
- data/lib/sfn/config/list.rb +6 -6
- data/lib/sfn/config/plan.rb +28 -0
- data/lib/sfn/config/print.rb +5 -5
- data/lib/sfn/config/promote.rb +4 -4
- data/lib/sfn/config/update.rb +18 -18
- data/lib/sfn/config/validate.rb +30 -30
- data/lib/sfn/lint.rb +5 -5
- data/lib/sfn/lint/definition.rb +3 -3
- data/lib/sfn/lint/rule.rb +3 -3
- data/lib/sfn/lint/rule_set.rb +2 -2
- data/lib/sfn/monkey_patch.rb +2 -2
- data/lib/sfn/monkey_patch/stack.rb +27 -27
- data/lib/sfn/monkey_patch/stack/azure.rb +1 -1
- data/lib/sfn/monkey_patch/stack/google.rb +5 -5
- data/lib/sfn/planner.rb +4 -4
- data/lib/sfn/planner/aws.rb +114 -70
- data/lib/sfn/provider.rb +13 -13
- data/lib/sfn/utils.rb +10 -10
- data/lib/sfn/utils/debug.rb +2 -2
- data/lib/sfn/utils/json.rb +1 -1
- data/lib/sfn/utils/object_storage.rb +3 -3
- data/lib/sfn/utils/output.rb +4 -4
- data/lib/sfn/utils/path_selector.rb +15 -15
- data/lib/sfn/utils/ssher.rb +4 -4
- data/lib/sfn/utils/stack_exporter.rb +16 -16
- data/lib/sfn/utils/stack_parameter_scrubber.rb +6 -6
- data/lib/sfn/utils/stack_parameter_validator.rb +22 -22
- data/lib/sfn/version.rb +1 -1
- data/sfn.gemspec +32 -32
- metadata +16 -13
data/lib/sfn/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
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] <<
|
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,
|
44
|
-
autoload :Create,
|
45
|
-
autoload :Describe,
|
46
|
-
autoload :Destroy,
|
47
|
-
autoload :Describe,
|
48
|
-
autoload :Diff,
|
49
|
-
autoload :Events,
|
50
|
-
autoload :Export,
|
51
|
-
autoload :Graph,
|
52
|
-
autoload :Import,
|
53
|
-
autoload :Init,
|
54
|
-
autoload :Inspect,
|
55
|
-
autoload :Lint,
|
56
|
-
autoload :List,
|
57
|
-
autoload :
|
58
|
-
autoload :
|
59
|
-
autoload :
|
60
|
-
autoload :
|
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 =>
|
65
|
-
:short_flag =>
|
65
|
+
:description => "Configuration file path",
|
66
|
+
:short_flag => "c",
|
66
67
|
)
|
67
68
|
|
68
69
|
attribute(
|
69
70
|
:credentials, Smash,
|
70
|
-
:description =>
|
71
|
-
:short_flag =>
|
71
|
+
:description => "Provider credentials",
|
72
|
+
:short_flag => "C",
|
72
73
|
)
|
73
74
|
attribute(
|
74
75
|
:ignore_parameters, String,
|
75
76
|
:multiple => true,
|
76
|
-
:description =>
|
77
|
-
:short_flag =>
|
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 =>
|
83
|
-
:short_flag =>
|
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 =>
|
89
|
-
:short_flag =>
|
89
|
+
:description => "Poll stack events on modification actions",
|
90
|
+
:short_flag => "p",
|
90
91
|
)
|
91
92
|
attribute(
|
92
93
|
:defaults, [TrueClass, FalseClass],
|
93
|
-
:description =>
|
94
|
-
:short_flag =>
|
94
|
+
:description => "Automatically accept default values",
|
95
|
+
:short_flag => "d",
|
95
96
|
)
|
96
97
|
attribute(
|
97
98
|
:yes, [TrueClass, FalseClass],
|
98
|
-
:description =>
|
99
|
-
:short_flag =>
|
99
|
+
:description => "Automatically accept any requests for confirmation",
|
100
|
+
:short_flag => "y",
|
100
101
|
)
|
101
102
|
attribute(
|
102
103
|
:debug, [TrueClass, FalseClass],
|
103
|
-
:description =>
|
104
|
-
:short_flag =>
|
104
|
+
:description => "Enable debug output",
|
105
|
+
:short_flag => "u",
|
105
106
|
)
|
106
107
|
attribute(
|
107
108
|
:colors, [TrueClass, FalseClass],
|
108
|
-
:description =>
|
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 = [
|
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
|
-
|
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
|
data/lib/sfn/config/conf.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
10
|
-
:short_flag =>
|
9
|
+
:description => "Generate a basic configuration file",
|
10
|
+
:short_flag => "g",
|
11
11
|
)
|
12
12
|
end
|
13
13
|
end
|
data/lib/sfn/config/create.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
11
|
-
:short_flag =>
|
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 =>
|
16
|
-
:short_flag =>
|
15
|
+
:description => "Rollback stack on failure",
|
16
|
+
:short_flag => "O",
|
17
17
|
)
|
18
18
|
attribute(
|
19
19
|
:options, Smash,
|
20
|
-
:description =>
|
21
|
-
:short_flag =>
|
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 =>
|
27
|
-
:short_flag =>
|
26
|
+
:description => "Notification endpoints for stack events",
|
27
|
+
:short_flag => "z",
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
data/lib/sfn/config/describe.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
require
|
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 =>
|
9
|
-
:short_flag =>
|
8
|
+
:description => "Display stack resource list",
|
9
|
+
:short_flag => "r",
|
10
10
|
)
|
11
11
|
|
12
12
|
attribute(
|
13
13
|
:outputs, [TrueClass, FalseClass],
|
14
|
-
:description =>
|
15
|
-
:short_flag =>
|
14
|
+
:description => "Display stack outputs",
|
15
|
+
:short_flag => "o",
|
16
16
|
)
|
17
17
|
|
18
18
|
attribute(
|
19
19
|
:tags, [TrueClass, FalseClass],
|
20
|
-
:description =>
|
21
|
-
:short_flag =>
|
20
|
+
:description => "Display stack tags",
|
21
|
+
:short_flag => "t",
|
22
22
|
)
|
23
23
|
end
|
24
24
|
end
|
data/lib/sfn/config/destroy.rb
CHANGED
data/lib/sfn/config/diff.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
11
|
-
:short_flag =>
|
10
|
+
:description => "Display raw diff information",
|
11
|
+
:short_flag => "w",
|
12
12
|
)
|
13
13
|
end
|
14
14
|
end
|
data/lib/sfn/config/events.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
11
|
-
:short_flag =>
|
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 =>
|
16
|
+
:description => "Seconds to pause between each event poll",
|
17
17
|
:coerce => lambda { |v| v.to_i },
|
18
|
-
:short_flag =>
|
18
|
+
:short_flag => "P",
|
19
19
|
)
|
20
20
|
attribute(
|
21
21
|
:all_attributes, [TrueClass, FalseClass],
|
22
|
-
:description =>
|
23
|
-
:short_flag =>
|
22
|
+
:description => "Display all event attributes",
|
23
|
+
:short_flag => "A",
|
24
24
|
)
|
25
25
|
attribute(
|
26
26
|
:all_events, [TrueClass, FalseClass],
|
27
|
-
:description =>
|
28
|
-
:short_flag =>
|
27
|
+
:description => "Display all available events",
|
28
|
+
:short_flag => "L",
|
29
29
|
)
|
30
30
|
end
|
31
31
|
end
|
data/lib/sfn/config/export.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
10
|
+
:description => "Export file base name",
|
11
11
|
)
|
12
12
|
attribute(
|
13
13
|
:path, String,
|
14
|
-
:description =>
|
14
|
+
:description => "Local path prefix for dump file",
|
15
15
|
)
|
16
16
|
attribute(
|
17
17
|
:bucket, String,
|
18
|
-
:description =>
|
18
|
+
:description => "Remote storage bucket",
|
19
19
|
)
|
20
20
|
attribute(
|
21
21
|
:bucket_prefix, String,
|
22
|
-
:description =>
|
22
|
+
:description => "Remote key prefix within bucket for dump file",
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
data/lib/sfn/config/graph.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
10
|
-
:short_flag =>
|
11
|
-
:default => File.join(Dir.pwd,
|
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 =>
|
17
|
-
:short_flag =>
|
18
|
-
:default =>
|
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 =>
|
24
|
-
:default =>
|
23
|
+
:description => "Style of graph (`dependency`, `creation`)",
|
24
|
+
:default => "creation",
|
25
25
|
)
|
26
26
|
|
27
27
|
attribute(
|
28
28
|
:luckymike, [TrueClass, FalseClass],
|
29
|
-
:description =>
|
29
|
+
:description => "Force `dependency` style graph",
|
30
30
|
:default => false,
|
31
31
|
)
|
32
32
|
end
|
data/lib/sfn/config/import.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
10
|
+
:description => "Directory path JSON export files are located",
|
11
11
|
)
|
12
12
|
attribute(
|
13
13
|
:bucket, String,
|
14
|
-
:description =>
|
14
|
+
:description => "Remote storage bucket JSON export files are located",
|
15
15
|
)
|
16
16
|
attribute(
|
17
17
|
:bucket_prefix, String,
|
18
|
-
:description =>
|
18
|
+
:description => "Remote key prefix within bucket for dump file",
|
19
19
|
)
|
20
20
|
end
|
21
21
|
end
|
data/lib/sfn/config/init.rb
CHANGED
data/lib/sfn/config/inspect.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 =>
|
11
|
-
:short_flag =>
|
10
|
+
:description => "Dot delimited attribute to view",
|
11
|
+
:short_flag => "a",
|
12
12
|
)
|
13
13
|
attribute(
|
14
14
|
:nodes, [TrueClass, FalseClass],
|
15
|
-
:description =>
|
16
|
-
:short_flag =>
|
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 =>
|
21
|
-
:short_flag =>
|
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 =>
|
26
|
-
:short_flag =>
|
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 =>
|
31
|
-
:default =>
|
32
|
-
:short_flag =>
|
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 =>
|
37
|
-
:short_flag =>
|
36
|
+
:description => "SSH identity file for authentication",
|
37
|
+
:short_flag => "D",
|
38
38
|
)
|
39
39
|
attribute(
|
40
40
|
:ssh_user, String,
|
41
|
-
:description =>
|
42
|
-
:short_flag =>
|
41
|
+
:description => "SSH username for inspection connect",
|
42
|
+
:short_flag => "s",
|
43
43
|
)
|
44
44
|
end
|
45
45
|
end
|