Class: SimpleDeploy::AWS::InstanceReader
- Inherits:
-
Object
- Object
- SimpleDeploy::AWS::InstanceReader
- Defined in:
- lib/simple_deploy/aws/instance_reader.rb
Instance Method Summary collapse
-
#initialize ⇒ InstanceReader
constructor
A new instance of InstanceReader.
- #list_stack_instances(stack_name) ⇒ Object
Constructor Details
#initialize ⇒ InstanceReader
Returns a new instance of InstanceReader.
4 5 6 |
# File 'lib/simple_deploy/aws/instance_reader.rb', line 4 def initialize @config = SimpleDeploy.config end |
Instance Method Details
#list_stack_instances(stack_name) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simple_deploy/aws/instance_reader.rb', line 8 def list_stack_instances(stack_name) instances = [] #Nested stack nested_stacks = nested_stacks_names(stack_name) instances = nested_stacks.map {|stack| list_stack_instances stack }.flatten if nested_stacks.any? #Auto Scaling Group asg_ids = auto_scaling_group_id(stack_name) asg_instances = asg_ids.map { |asg_id| list_instances asg_id }.flatten #EC2 instance stack_instances = instance_names(stack_name) instances += (describe_instances (asg_instances + stack_instances)) if (asg_instances + stack_instances).any? instances end |