class StackMaster::Commands::Lint

Public Instance Methods

perform() click to toggle source
# File lib/stack_master/commands/lint.rb, line 9
def perform
  unless cfn_lint_available
    failed! 'Failed to run cfn-lint. You may need to install it using'\
            '`pip install cfn-lint`, or add it to $PATH.'\
            "\n"\
            '(See https://github.com/aws-cloudformation/cfn-python-lint'\
            ' for package information)'
  end

  Tempfile.open(['stack', ".#{proposed_stack.template_format}"]) do |f|
    f.write(proposed_stack.template_body)
    f.flush
    system('cfn-lint', f.path)
    puts "cfn-lint run complete"
  end
end

Private Instance Methods

cfn_lint_available() click to toggle source
# File lib/stack_master/commands/lint.rb, line 36
def cfn_lint_available
  !system('cfn-lint', '--version').nil?
end
proposed_stack() click to toggle source
# File lib/stack_master/commands/lint.rb, line 32
def proposed_stack
  @proposed_stack ||= Stack.generate(stack_definition, @config)
end
stack_definition() click to toggle source
# File lib/stack_master/commands/lint.rb, line 28
def stack_definition
  @stack_definition ||= @config.find_stack(@region, @stack_name)
end