lib/sfn/command/diff.rb in sfn-2.2.0 vs lib/sfn/command/diff.rb in sfn-3.0.0
- old
+ new
@@ -15,21 +15,19 @@
def execute!
name_required!
name = name_args.first
begin
- stack = provider.connection.stacks.get(name)
+ stack = provider.stack(name)
rescue Miasma::Error::ApiError::RequestError
stack = nil
end
if(stack)
config[:print_only] = true
file = load_template_file
- file.delete('sfn_nested_stack')
- file = Sfn::Utils::StackParameterScrubber.scrub!(file)
- file = translate_template(file)
+ file = parameter_scrub!(file.dump)
ui.info "#{ui.color('SparkleFormation:', :bold)} #{ui.color('diff', :blue)} - #{name}"
ui.puts
diff_stack(stack, MultiJson.load(MultiJson.dump(file)).to_smash)
@@ -37,13 +35,14 @@
ui.fatal "Failed to locate requested stack: #{ui.color(name, :red, :bold)}"
raise "Failed to locate stack: #{name}"
end
end
+ # @todo needs updates for better provider compat
def diff_stack(stack, file, parent_names=[])
stack_template = stack.template
nested_stacks = Hash[
- file['Resources'].find_all do |name, value|
+ file.fetch('Resources', file.fetch('resources', {})).find_all do |name, value|
value.fetch('Properties', {})['Stack']
end
]
nested_stacks.each do |name, value|
n_stack = stack.nested_stacks(false).detect do |ns|