forked from techlunacy/cloud-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcf-list
More file actions
executable file
·30 lines (23 loc) · 787 Bytes
/
cf-list
File metadata and controls
executable file
·30 lines (23 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "fog"
require "fileutils"
require 'trollop'
require 'yaml'
def set_environment(environment)
environments[environment]
end
def environments
YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'config/config.yml'))
end
opts = Trollop::options do
opt :environment, "", :type => :string
end
Trollop::die :environment, "needs an environment. Valid values(#{environments.keys.join(',')})" unless environments.keys.include? opts[:environment]
settings = set_environment(opts[:environment])
@connection = Fog::AWS::CloudFormation.new(settings)
stacks = @connection.list_stacks.body["StackSummaries"]
stacks.each do |stack|
puts stack['StackName'] if stack["StackStatus"] !='DELETE_COMPLETE'
end