Class: Chef::Knife::CloudformationList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::CloudformationList
- Includes:
- KnifeCloudformation::Knife::Base
- Defined in:
- lib/chef/knife/cloudformation_list.rb
Overview
Cloudformation list command
Instance Method Summary collapse
-
#_run ⇒ Object
Run the list command.
-
#default_attributes ⇒ Array<String>
Default attributes to display.
-
#get_list ⇒ Array<Hash>
Get the list of stacks to display.
Methods included from KnifeCloudformation::Knife::Base
Instance Method Details
#_run ⇒ Object
Run the list command
38 39 40 |
# File 'lib/chef/knife/cloudformation_list.rb', line 38 def _run things_output(nil, get_list, nil) end |
#default_attributes ⇒ Array<String>
Returns default attributes to display.
62 63 64 65 66 67 68 |
# File 'lib/chef/knife/cloudformation_list.rb', line 62 def default_attributes if(provider.connection.provider == :aws) %w(name created status template_description) else %w(name created status description) end end |
#get_list ⇒ Array<Hash>
Get the list of stacks to display
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/chef/knife/cloudformation_list.rb', line 45 def get_list get_things do provider.stacks.all.map do |stack| Mash.new(stack.attributes) end.sort do |x, y| if(y[:created].to_s.empty?) -1 elsif(x[:created].to_s.empty?) 1 else Time.parse(y['created'].to_s) <=> Time.parse(x['created'].to_s) end end end end |