34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/routes/cloudformation_detect_drift.rb', line 34
def opts_routing
threads = []
puts
stacks = App::AWSCloudFormation::get_stacks
puts
system("rm #{TMP_OUTPUT}")
system("touch #{TMP_OUTPUT}")
stacks.each do |stack|
sleep(0.01)
threads << Thread.new {
cmd = "aws cloudformation detect-stack-drift --stack-name #{stack[:name]} --region #{stack[:region]}#{App::AWS::get_profile_for_cli} >> #{TMP_OUTPUT} 2>&1"
App::AWSOutputter::output_cli_command(cmd)
`#{cmd}`
}
end
sleep(0.1)
puts
Blufin::Terminal::execute_proc("AWS \xe2\x80\x94 Detecting Drift...", Proc.new {
threads.each { |thread| thread.join }
})
output = `cat #{TMP_OUTPUT}`
output.split("\n").each do |line|
line = line.strip
next if line == ''
next if line =~ /^\{$/
next if line =~ /^\}$/
next if line =~ /"StackDriftDetectionId":\s*"[A-Za-z0-9-]+"/
puts
puts "\x1B[38;5;196m#{line}\x1B[0m"
end
puts
end
|