Sha256: 500e601c162618d488da28510667dd9699a2c37001bd0f9e832da8f7c55ee0b9

Contents?: true

Size: 952 Bytes

Versions: 11

Compression:

Stored size: 952 Bytes

Contents

require 'pathname'
require 'sparkle_formation'
require 'sfn'

module Sfn
  class Command
    # Validate command
    class Validate < Command

      include Sfn::CommandModule::Base
      include Sfn::CommandModule::Template

      def execute!
        file = load_template_file
        file.delete('sfn_nested_stack')
        ui.info "#{ui.color("Template Validation (#{provider.connection.provider}): ", :bold)} #{config[:file].sub(Dir.pwd, '').sub(%r{^/}, '')}"
        file = Sfn::Utils::StackParameterScrubber.scrub!(file)
        file = translate_template(file)
        begin
          result = provider.connection.stacks.build(
            :name => 'validation-stack',
            :template => file
          ).validate
          ui.info ui.color('  -> VALID', :bold, :green)
        rescue => e
          ui.info ui.color('  -> INVALID', :bold, :red)
          ui.fatal e.message
          failed = true
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sfn-0.4.10 lib/sfn/command/validate.rb
sfn-0.4.8 lib/sfn/command/validate.rb
sfn-0.4.6 lib/sfn/command/validate.rb
sfn-0.4.4 lib/sfn/command/validate.rb
sfn-0.4.2 lib/sfn/command/validate.rb
sfn-0.4.0 lib/sfn/command/validate.rb
sfn-0.3.8 lib/sfn/command/validate.rb
sfn-0.3.6 lib/sfn/command/validate.rb
sfn-0.3.4 lib/sfn/command/validate.rb
sfn-0.3.2 lib/sfn/command/validate.rb
sfn-0.3.0 lib/sfn/command/validate.rb