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/lint.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
class Config
|
@@ -6,22 +6,22 @@ module Sfn
|
|
6
6
|
class Lint < Validate
|
7
7
|
attribute(
|
8
8
|
:lint_directory, String,
|
9
|
-
:description =>
|
9
|
+
:description => "Directory containing lint rule sets",
|
10
10
|
:multiple => true,
|
11
11
|
)
|
12
12
|
attribute(
|
13
13
|
:disabled_rule_set, String,
|
14
|
-
:description =>
|
14
|
+
:description => "Disable rule set from being applied",
|
15
15
|
:multiple => true,
|
16
16
|
)
|
17
17
|
attribute(
|
18
18
|
:enabled_rule_set, String,
|
19
|
-
:description =>
|
19
|
+
:description => "Only apply this rule set",
|
20
20
|
:multiple => true,
|
21
21
|
)
|
22
22
|
attribute(
|
23
23
|
:local_rule_sets_only, [TrueClass, FalseClass],
|
24
|
-
:description =>
|
24
|
+
:description => "Only apply rule sets provided by lint directory",
|
25
25
|
:default => false,
|
26
26
|
)
|
27
27
|
end
|
data/lib/sfn/config/list.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
|
attribute(
|
8
8
|
:attribute, String,
|
9
9
|
:multiple => true,
|
10
|
-
:description =>
|
11
|
-
:short_flag =>
|
10
|
+
:description => "Attribute of stack to print",
|
11
|
+
:short_flag => "a",
|
12
12
|
)
|
13
13
|
attribute(
|
14
14
|
:all_attributes, [TrueClass, FalseClass],
|
15
|
-
:description =>
|
16
|
-
:short_flag =>
|
15
|
+
:description => "Print all available attributes",
|
16
|
+
:short_flag => "A",
|
17
17
|
)
|
18
18
|
attribute(
|
19
19
|
:status, String,
|
20
20
|
:multiple => true,
|
21
21
|
:description => 'Match stacks with given status. Use "none" to disable.',
|
22
|
-
:short_flag =>
|
22
|
+
:short_flag => "s",
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "sfn"
|
2
|
+
|
3
|
+
module Sfn
|
4
|
+
class Config
|
5
|
+
# Plan command configuration
|
6
|
+
class Plan < Create
|
7
|
+
# Remove the plan option. Command specific options will
|
8
|
+
# cause a conflict if same option name as command is used.
|
9
|
+
# Also, since this is a plan command, we are always running
|
10
|
+
# a plan, because that's the command.
|
11
|
+
attributes.delete(:plan)
|
12
|
+
# Default diffs to be enabled
|
13
|
+
attributes.set(:diffs, :default, true)
|
14
|
+
|
15
|
+
attribute(
|
16
|
+
:plan_name, String,
|
17
|
+
:description => "Custom plan name or ID (not applicable to all providers)",
|
18
|
+
)
|
19
|
+
|
20
|
+
attribute(
|
21
|
+
:list, BOOLEAN,
|
22
|
+
:description => "List all available plans for stack",
|
23
|
+
:default => false,
|
24
|
+
:short_flag => "l",
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/sfn/config/print.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
class Config
|
@@ -6,18 +6,18 @@ module Sfn
|
|
6
6
|
class Print < Validate
|
7
7
|
attribute(
|
8
8
|
:write_to_file, String,
|
9
|
-
:description =>
|
10
|
-
:short_flag =>
|
9
|
+
:description => "Write compiled SparkleFormation template to path provided",
|
10
|
+
:short_flag => "w",
|
11
11
|
)
|
12
12
|
|
13
13
|
attribute(
|
14
14
|
:sparkle_dump, [TrueClass, FalseClass],
|
15
|
-
:description =>
|
15
|
+
:description => "Do not use provider customized dump behavior",
|
16
16
|
)
|
17
17
|
|
18
18
|
attribute(
|
19
19
|
:yaml, [TrueClass, FalseClass],
|
20
|
-
:description =>
|
20
|
+
:description => "Output template content in YAML format",
|
21
21
|
)
|
22
22
|
end
|
23
23
|
end
|
data/lib/sfn/config/promote.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
class Config
|
@@ -6,15 +6,15 @@ module Sfn
|
|
6
6
|
class Promote < Config
|
7
7
|
attribute(
|
8
8
|
:accounts, String,
|
9
|
-
:description =>
|
9
|
+
:description => "JSON accounts file path",
|
10
10
|
)
|
11
11
|
attribute(
|
12
12
|
:bucket, String,
|
13
|
-
:description =>
|
13
|
+
:description => "Bucket name containing the exports",
|
14
14
|
)
|
15
15
|
attribute(
|
16
16
|
:bucket_prefix, String,
|
17
|
-
:description =>
|
17
|
+
:description => "Key prefix within remote bucket",
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
data/lib/sfn/config/update.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
class Config
|
@@ -7,22 +7,22 @@ module Sfn
|
|
7
7
|
attribute(
|
8
8
|
:apply_stack, String,
|
9
9
|
:multiple => true,
|
10
|
-
:description =>
|
11
|
-
:short_flag =>
|
10
|
+
:description => "Apply outputs from stack to input parameters",
|
11
|
+
:short_flag => "A",
|
12
12
|
)
|
13
13
|
attribute(
|
14
14
|
:apply_mapping, Smash,
|
15
|
-
:description =>
|
15
|
+
:description => "Customize apply stack mapping as [StackName__]OutputName:ParameterName",
|
16
16
|
)
|
17
17
|
attribute(
|
18
18
|
:parameter, Smash,
|
19
19
|
:multiple => true,
|
20
|
-
:description =>
|
20
|
+
:description => "[DEPRECATED - use `parameters`] Pass template parameters directly (ParamName:ParamValue)",
|
21
21
|
:coerce => lambda { |v, inst|
|
22
22
|
result = inst.data[:parameter] || Array.new
|
23
23
|
case v
|
24
24
|
when String
|
25
|
-
v.split(
|
25
|
+
v.split(",").each do |item|
|
26
26
|
result.push(Smash[*item.split(/[=:]/, 2)])
|
27
27
|
end
|
28
28
|
else
|
@@ -30,39 +30,39 @@ module Sfn
|
|
30
30
|
end
|
31
31
|
{:bogo_multiple => result}
|
32
32
|
},
|
33
|
-
:short_flag =>
|
33
|
+
:short_flag => "R",
|
34
34
|
)
|
35
35
|
attribute(
|
36
36
|
:parameters, Smash,
|
37
|
-
:description =>
|
38
|
-
:short_flag =>
|
37
|
+
:description => "Pass template parameters directly",
|
38
|
+
:short_flag => "m",
|
39
39
|
)
|
40
40
|
attribute(
|
41
41
|
:plan, [TrueClass, FalseClass],
|
42
42
|
:default => true,
|
43
|
-
:description =>
|
44
|
-
:short_flag =>
|
43
|
+
:description => "Provide planning information prior to update",
|
44
|
+
:short_flag => "l",
|
45
45
|
)
|
46
46
|
attribute(
|
47
47
|
:plan_only, [TrueClass, FalseClass],
|
48
48
|
:default => false,
|
49
|
-
:description =>
|
49
|
+
:description => "Exit after plan display",
|
50
50
|
)
|
51
51
|
attribute(
|
52
52
|
:diffs, [TrueClass, FalseClass],
|
53
|
-
:description =>
|
54
|
-
:short_flag =>
|
53
|
+
:description => "Show planner content diff",
|
54
|
+
:short_flag => "D",
|
55
55
|
)
|
56
56
|
attribute(
|
57
57
|
:merge_api_options, [TrueClass, FalseClass],
|
58
|
-
:description =>
|
58
|
+
:description => "Merge API options defined within configuration on update",
|
59
59
|
:default => false,
|
60
60
|
)
|
61
61
|
attribute(
|
62
62
|
:parameter_validation, String,
|
63
|
-
:allowed => [
|
64
|
-
:description =>
|
65
|
-
:default =>
|
63
|
+
:allowed => ["default", "none", "current", "expected"],
|
64
|
+
:description => "Stack parameter validation behavior",
|
65
|
+
:default => "default",
|
66
66
|
)
|
67
67
|
end
|
68
68
|
end
|
data/lib/sfn/config/validate.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
class Config
|
@@ -6,80 +6,80 @@ module Sfn
|
|
6
6
|
class Validate < Config
|
7
7
|
attribute(
|
8
8
|
:processing, [TrueClass, FalseClass],
|
9
|
-
:description =>
|
9
|
+
:description => "Call the unicorns and explode the glitter bombs",
|
10
10
|
:default => true,
|
11
|
-
:short_flag =>
|
11
|
+
:short_flag => "P",
|
12
12
|
)
|
13
13
|
attribute(
|
14
14
|
:file, String,
|
15
|
-
:description =>
|
15
|
+
:description => "Path to template file",
|
16
16
|
:default => nil,
|
17
|
-
:short_flag =>
|
17
|
+
:short_flag => "f",
|
18
18
|
)
|
19
19
|
attribute(
|
20
20
|
:file_path_prompt, [TrueClass, FalseClass],
|
21
21
|
:default => true,
|
22
|
-
:description =>
|
23
|
-
:short_flag =>
|
22
|
+
:description => "Enable interactive prompt for template path discovery",
|
23
|
+
:short_flag => "F",
|
24
24
|
)
|
25
25
|
attribute(
|
26
26
|
:base_directory, String,
|
27
|
-
:description =>
|
28
|
-
:short_flag =>
|
27
|
+
:description => "Path to root of of templates directory",
|
28
|
+
:short_flag => "b",
|
29
29
|
)
|
30
30
|
attribute(
|
31
31
|
:no_base_directory, [TrueClass, FalseClass],
|
32
|
-
:description =>
|
33
|
-
:short_flag =>
|
32
|
+
:description => "Unset any value used for the template root directory path",
|
33
|
+
:short_flag => "n",
|
34
34
|
)
|
35
35
|
attribute(
|
36
36
|
:translate, String,
|
37
|
-
:description =>
|
38
|
-
:short_flag =>
|
37
|
+
:description => "Translate generated template to given provider",
|
38
|
+
:short_flag => "t",
|
39
39
|
)
|
40
40
|
attribute(
|
41
41
|
:translate_chunk, Integer,
|
42
|
-
:description =>
|
42
|
+
:description => "Chunk length for serialization",
|
43
43
|
:coerce => lambda { |v| v.to_i },
|
44
|
-
:short_flag =>
|
44
|
+
:short_flag => "T",
|
45
45
|
)
|
46
46
|
attribute(
|
47
47
|
:apply_nesting, [String, Symbol],
|
48
|
-
:default =>
|
49
|
-
:description =>
|
50
|
-
:short_flag =>
|
48
|
+
:default => "deep",
|
49
|
+
:description => "Apply stack nesting",
|
50
|
+
:short_flag => "a",
|
51
51
|
)
|
52
52
|
attribute(
|
53
53
|
:nesting_bucket, String,
|
54
|
-
:description =>
|
55
|
-
:short_flag =>
|
54
|
+
:description => "Bucket to use for storing nested stack templates",
|
55
|
+
:short_flag => "N",
|
56
56
|
)
|
57
57
|
attribute(
|
58
58
|
:nesting_prefix, String,
|
59
|
-
:description =>
|
60
|
-
:short_flag =>
|
59
|
+
:description => "File name prefix for storing template in bucket",
|
60
|
+
:short_flag => "Y",
|
61
61
|
)
|
62
62
|
attribute(
|
63
63
|
:print_only, [TrueClass, FalseClass],
|
64
|
-
:description =>
|
65
|
-
:short_flag =>
|
64
|
+
:description => "Print the resulting stack template",
|
65
|
+
:short_flag => "r",
|
66
66
|
)
|
67
67
|
attribute(
|
68
68
|
:sparkle_pack, String,
|
69
69
|
:multiple => true,
|
70
|
-
:description =>
|
70
|
+
:description => "Load SparklePack gem",
|
71
71
|
:coerce => lambda { |s| s.to_s },
|
72
|
-
:short_flag =>
|
72
|
+
:short_flag => "s",
|
73
73
|
)
|
74
74
|
attribute(
|
75
75
|
:compile_parameters, Smash,
|
76
|
-
:description =>
|
77
|
-
:short_flag =>
|
76
|
+
:description => "Pass template compile time parameters directly",
|
77
|
+
:short_flag => "o",
|
78
78
|
:coerce => lambda { |v|
|
79
79
|
case v
|
80
80
|
when String
|
81
81
|
result = Smash.new
|
82
|
-
v.split(
|
82
|
+
v.split(",").each do |item_pair|
|
83
83
|
key, value = item_pair.split(/[=:]/, 2)
|
84
84
|
result[key] = value
|
85
85
|
end
|
@@ -104,7 +104,7 @@ module Sfn
|
|
104
104
|
)
|
105
105
|
attribute(
|
106
106
|
:upload_root_template, [TrueClass, FalseClass],
|
107
|
-
:description =>
|
107
|
+
:description => "Upload root template to storage bucket",
|
108
108
|
)
|
109
109
|
end
|
110
110
|
end
|
data/lib/sfn/lint.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "sfn"
|
2
|
+
require "jmespath"
|
3
3
|
|
4
4
|
module Sfn
|
5
5
|
module Lint
|
6
|
-
autoload :Definition,
|
7
|
-
autoload :Rule,
|
8
|
-
autoload :RuleSet,
|
6
|
+
autoload :Definition, "sfn/lint/definition"
|
7
|
+
autoload :Rule, "sfn/lint/rule"
|
8
|
+
autoload :RuleSet, "sfn/lint/rule_set"
|
9
9
|
end
|
10
10
|
end
|
data/lib/sfn/lint/definition.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
module Lint
|
@@ -20,7 +20,7 @@ module Sfn
|
|
20
20
|
# @return [self]
|
21
21
|
def initialize(expr, provider = :aws, evaluator = nil, &block)
|
22
22
|
if evaluator && block
|
23
|
-
raise ArgumentError.new
|
23
|
+
raise ArgumentError.new "Only evaluator or block can be provided, not both."
|
24
24
|
end
|
25
25
|
@provider = Bogo::Utility.snake(provider).to_sym
|
26
26
|
@search_expression = expr
|
@@ -46,7 +46,7 @@ module Sfn
|
|
46
46
|
# @note override this method when subclassing
|
47
47
|
def run(result, template)
|
48
48
|
unless evaluator
|
49
|
-
raise NotImplementedError.new
|
49
|
+
raise NotImplementedError.new "No evaluator has been defined for this definition!"
|
50
50
|
end
|
51
51
|
evaluator.call(result, template)
|
52
52
|
end
|
data/lib/sfn/lint/rule.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
module Lint
|
@@ -40,7 +40,7 @@ module Sfn
|
|
40
40
|
f_item
|
41
41
|
end.flatten.compact.map(&:to_s)
|
42
42
|
unless failed_items.empty?
|
43
|
-
msg = "#{msg} (failures: `#{failed_items.join(
|
43
|
+
msg = "#{msg} (failures: `#{failed_items.join("`, `")}`)"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
msg
|
@@ -109,7 +109,7 @@ module Sfn
|
|
109
109
|
end
|
110
110
|
unless non_match.empty?
|
111
111
|
raise ArgumentError.new "Rule defines `#{provider}` as provider but includes definitions for " \
|
112
|
-
"non matching providers. (#{non_match.map(&:provider).map(&:to_s).uniq.sort.join(
|
112
|
+
"non matching providers. (#{non_match.map(&:provider).map(&:to_s).uniq.sort.join(", ")})"
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
data/lib/sfn/lint/rule_set.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sfn"
|
2
2
|
|
3
3
|
module Sfn
|
4
4
|
module Lint
|
@@ -160,7 +160,7 @@ module Sfn
|
|
160
160
|
end
|
161
161
|
unless non_match.empty?
|
162
162
|
raise ArgumentError.new "Rule set defines `#{provider}` as provider but includes rules for " \
|
163
|
-
"non matching providers. (#{non_match.map(&:provider).map(&:to_s).uniq.sort.join(
|
163
|
+
"non matching providers. (#{non_match.map(&:provider).map(&:to_s).uniq.sort.join(", ")})"
|
164
164
|
end
|
165
165
|
end
|
166
166
|
end
|
data/lib/sfn/monkey_patch.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "base64"
|
2
|
+
require "sfn"
|
3
3
|
|
4
4
|
module Sfn
|
5
5
|
module MonkeyPatch
|
6
6
|
|
7
7
|
# Expand stack model functionality
|
8
8
|
module Stack
|
9
|
-
autoload :Azure,
|
10
|
-
autoload :Google,
|
9
|
+
autoload :Azure, "sfn/monkey_patch/stack/azure"
|
10
|
+
autoload :Google, "sfn/monkey_patch/stack/google"
|
11
11
|
|
12
12
|
include Bogo::AnimalStrings
|
13
13
|
include Azure
|
@@ -92,7 +92,7 @@ module Sfn
|
|
92
92
|
# @return [String] action currently being performed
|
93
93
|
def performing
|
94
94
|
if in_progress?
|
95
|
-
status.to_s.downcase.split(
|
95
|
+
status.to_s.downcase.split("_").first.to_sym
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -143,9 +143,9 @@ module Sfn
|
|
143
143
|
self.send("percent_complete_#{api.provider}", min)
|
144
144
|
else
|
145
145
|
if in_progress?
|
146
|
-
total_resources = template.fetch(
|
146
|
+
total_resources = template.fetch("Resources", []).size
|
147
147
|
total_complete = resources.all.find_all do |resource|
|
148
|
-
resource.status.downcase.end_with?(
|
148
|
+
resource.status.downcase.end_with?("complete")
|
149
149
|
end.size
|
150
150
|
result = ((total_complete.to_f / total_resources) * 100).to_i
|
151
151
|
result > min.to_i ? result : min
|
@@ -176,20 +176,20 @@ module Sfn
|
|
176
176
|
stack_parameters = template[opts[:parameter_key]]
|
177
177
|
default_key = opts.fetch(
|
178
178
|
:default_key,
|
179
|
-
opts[:parameter_key].to_s[0, 1].match(/[a-z]/) ?
|
179
|
+
opts[:parameter_key].to_s[0, 1].match(/[a-z]/) ? "default" : "Default"
|
180
180
|
)
|
181
181
|
else
|
182
|
-
if template[
|
183
|
-
default_key =
|
184
|
-
stack_parameters = template[
|
182
|
+
if template["Parameters"]
|
183
|
+
default_key = "Default"
|
184
|
+
stack_parameters = template["Parameters"]
|
185
185
|
else
|
186
|
-
default_key =
|
187
|
-
stack_parameters = template[
|
186
|
+
default_key = "default"
|
187
|
+
stack_parameters = template["parameters"]
|
188
188
|
end
|
189
189
|
end
|
190
190
|
if stack_parameters
|
191
191
|
valid_parameters = stack_parameters.find_all do |key, val|
|
192
|
-
!val[
|
192
|
+
!val["DisableApply"] && !val["disable_apply"]
|
193
193
|
end.map(&:first)
|
194
194
|
if ignore_params
|
195
195
|
valid_parameters.reject! do |key|
|
@@ -197,17 +197,17 @@ module Sfn
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
remote_stack.outputs.each do |output|
|
200
|
-
o_key = output.key.downcase.tr(
|
200
|
+
o_key = output.key.downcase.tr("_", "")
|
201
201
|
p_key = valid_parameters.detect do |v_param|
|
202
|
-
v_param.downcase.tr(
|
202
|
+
v_param.downcase.tr("_", "") == o_key
|
203
203
|
end
|
204
204
|
unless p_key
|
205
205
|
map_key = opts[:mapping].keys.detect do |map_key|
|
206
|
-
map_key.downcase.tr(
|
206
|
+
map_key.downcase.tr("_", "") == o_key
|
207
207
|
end
|
208
208
|
if map_key
|
209
209
|
p_key = valid_parameters.detect do |v_param|
|
210
|
-
v_param.downcase.tr(
|
210
|
+
v_param.downcase.tr("_", "") == opts[:mapping][map_key].downcase.tr("_", "")
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
@@ -231,8 +231,8 @@ module Sfn
|
|
231
231
|
resources.reload.all.map do |resource|
|
232
232
|
if api.data.fetch(:stack_types, []).include?(resource.type)
|
233
233
|
# Custom remote load support
|
234
|
-
if resource.type ==
|
235
|
-
location, stack_id = resource.id.to_s.split(
|
234
|
+
if resource.type == "Custom::JackalStack"
|
235
|
+
location, stack_id = resource.id.to_s.split("-", 2)
|
236
236
|
if l_conf = api.data[:locations][location]
|
237
237
|
n_stack = Miasma.api(
|
238
238
|
:type => :orchestration,
|
@@ -279,13 +279,13 @@ module Sfn
|
|
279
279
|
if (self.api.provider == :aws) # cause this is the only one
|
280
280
|
begin
|
281
281
|
result = self.api.request(
|
282
|
-
:path =>
|
282
|
+
:path => "/",
|
283
283
|
:form => Smash.new(
|
284
|
-
|
285
|
-
|
284
|
+
"Action" => "GetStackPolicy",
|
285
|
+
"StackName" => self.id,
|
286
286
|
),
|
287
287
|
)
|
288
|
-
serialized_policy = result.get(:body,
|
288
|
+
serialized_policy = result.get(:body, "GetStackPolicyResult", "StackPolicyBody")
|
289
289
|
MultiJson.load(serialized_policy).to_smash
|
290
290
|
rescue Miasma::Error::ApiError::RequestError => e
|
291
291
|
if e.response.code == 404
|
@@ -310,10 +310,10 @@ module Sfn
|
|
310
310
|
self.send("nesting_style_#{api.provider}")
|
311
311
|
else
|
312
312
|
if nested?
|
313
|
-
self.template[
|
314
|
-
t_resource[
|
313
|
+
self.template["Resources"].find_all do |t_resource|
|
314
|
+
t_resource["Type"] == self.api.class.const_get(:RESOURCE_MAPPING).key(self.class)
|
315
315
|
end.detect do |t_resource|
|
316
|
-
t_resource[
|
316
|
+
t_resource["Properties"].fetch("Parameters", {}).values.detect do |t_value|
|
317
317
|
!t_value.is_a?(Hash)
|
318
318
|
end
|
319
319
|
end ? :deep : :shallow
|