Class: Chef::Provider::AwsInstance

Inherits:
Chef::Provisioning::AWSDriver::AWSProvider show all
Includes:
Chef::Provisioning::AWSDriver::TaggingStrategy::EC2ConvergeTags
Defined in:
lib/chef/provider/aws_instance.rb

Constant Summary

Constants inherited from Chef::Provisioning::AWSDriver::AWSProvider

Chef::Provisioning::AWSDriver::AWSProvider::AWSResource

Instance Attribute Summary

Attributes inherited from Chef::Provisioning::AWSDriver::AWSProvider

#purging

Instance Method Summary collapse

Methods included from Chef::Provisioning::AWSDriver::TaggingStrategy::EC2ConvergeTags

#aws_tagger, #converge_tags

Methods inherited from Chef::Provisioning::AWSDriver::AWSProvider

#action_handler, #converge_by, #region, #whyrun_supported?

Instance Method Details

#create_aws_object(instance) ⇒ Object



9
# File 'lib/chef/provider/aws_instance.rb', line 9

def create_aws_object(instance); end

#destroy_aws_object(instance) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chef/provider/aws_instance.rb', line 13

def destroy_aws_object(instance)
  message = "delete instance #{new_resource}"
  message += " in VPC #{instance.vpc.id}" unless instance.vpc.nil?
  message += " in #{region}"
  converge_by message do
    instance.terminate
  end
  converge_by "waited until instance #{new_resource} is :terminated" do
    # When purging, we must wait until the instance is fully terminated - thats the only way
    # to delete the network interface that I can see
    instance.wait_until_terminated do |w|
      # TODO look at `wait_for_status` - delay and max_attempts should be configurable
      w.delay = 5
      w.max_attempts = 60
      w.before_wait do |attempts, response|
        action_handler.report_progress "waited #{(attempts-1)*5}/#{60*5}s for #{instance.id} status to terminate..."
      end
    end
  end
end

#update_aws_object(instance) ⇒ Object



11
# File 'lib/chef/provider/aws_instance.rb', line 11

def update_aws_object(instance); end