Class: StackMaster::Commands::Lint

Inherits:
Object
  • Object
show all
Includes:
Commander::UI, StackMaster::Command
Defined in:
lib/stack_master/commands/lint.rb

Instance Method Summary collapse

Methods included from StackMaster::Command

included, #initialize, #success?

Instance Method Details

#performObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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