Sha256: fd0facaba234382d7c0a4507e7000653a4b90beba647925582a0a2e25f75a6dc
Contents?: true
Size: 897 Bytes
Versions: 6
Compression:
Stored size: 897 Bytes
Contents
module Stackster class InstanceReader def initialize(args) @config = args[:config] end def list_stack_instances(stack_name) h = [] describe_instances.each do |instance| tag_set = instance['instancesSet'].first['tagSet'] instance_stack_name = tag_set['aws:cloudformation:stack-name'] if instance_stack_name && instance_stack_name == stack_name if instance_running? instance h << instance end end end h end private def ec2 @ec2 ||= AWS::EC2.new :config => @config end def get_instance_state(instance_hash) instance_hash['instancesSet'].first['instanceState']['name'] end def instance_running?(instance_hash) get_instance_state(instance_hash) == 'running' end def describe_instances ec2.describe_instances end end end
Version data entries
6 entries across 6 versions & 1 rubygems