Class: Stax::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/stax/lint/checkov.rb,
lib/stax/lint/cfn-lint.rb

Instance Method Summary collapse

Instance Method Details

#checkovObject



4
5
6
7
8
9
10
11
12
# File 'lib/stax/lint/checkov.rb', line 4

def checkov
  debug("checkov #{stack_name}")
  file = Tempfile.create(["#{stack_name}-", '.json'])
  file.write(cfn_template)
  file.flush
  Dir.chdir(File.dirname(file.path)) do
    system "checkov --quiet --compact --framework cloudformation -f #{File.basename(file.path)}"
  end
end

#lintObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/stax/lint/cfn-lint.rb', line 4

def lint
  require 'open3'
  debug("cfn-lint #{stack_name}")
  Open3.popen3('cfn-lint -') do |stdin, stdout|
    stdin.write(cfn_template)
    stdin.close
    puts stdout.read
  end
rescue Errno::ENOENT => e
  fail_task(e.message)
end