Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented fix in issue #134 #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions lib/ec2/right_ec2_instances.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_desc_instances(instances) # :nodoc:
# Retrieve information about EC2 instances.
#
# Accepts a list of instances and/or a set of filters as the last parameter.
#
#
# Filters: architecture, availability-zone, block-device-mapping.attach-time, block-device-mapping.delete-on-termination,
# block-device-mapping.device-name, block-device-mapping.status, block-device-mapping.volume-id, client-token, dns-name,
# group-id, image-id, instance-id, instance-lifecycle, instance-state-code, instance-state-name, instance-type, ip-address,
Expand Down Expand Up @@ -175,12 +175,12 @@ def run_instances(image_id, min_count, max_count, group_names, key_name, user_da
end

# Launch new EC2 instances.
#
#
# Options: :image_id, :min_count, max_count, :key_name, :kernel_id, :ramdisk_id,
# :availability_zone, :monitoring_enabled, :subnet_id, :disable_api_termination, :instance_initiated_shutdown_behavior,
# :block_device_mappings, :placement_group_name, :license_pool, :group_ids, :group_names, :private_ip_address,
# :ebs_optimized
#
#
# Returns a list of launched instances or an exception.
#
# ec2.launch_instances( "ami-78779511",
Expand Down Expand Up @@ -364,7 +364,7 @@ def describe_instance_attribute(instance_id, attribute)
# Describe instance attribute.
#
# Attributes: 'kernel', 'ramdisk', 'sourceDestCheck'
#
#
# ec2.reset_instance_attribute(instance, 'kernel') #=> true
#
def reset_instance_attribute(instance_id, attribute)
Expand Down Expand Up @@ -397,6 +397,20 @@ def modify_instance_attribute(instance_id, attribute, value)
on_exception
end

# The existing modify_instance_attribute method does not work properly for modifying block device attributes.
#
# ec2.modify_block_device_delete_on_termination_attribute(instance, "/dev/sdi", "true") #=> true
#
def modify_block_device_delete_on_termination_attribute(instance_id, device_name, delete_on_termination)
request_hash = {'InstanceId' => instance_id}
request_hash["BlockDeviceMapping.1.DeviceName"] = device_name
request_hash["BlockDeviceMapping.1.Ebs.DeleteOnTermination"] = delete_on_termination
link = generate_request('ModifyInstanceAttribute', request_hash)
request_info(link, RightBoolResponseParser.new(:logger => @logger))
rescue Exception
on_exception
end

#-----------------------------------------------------------------
# Instances: Windows addons
#-----------------------------------------------------------------
Expand Down Expand Up @@ -794,4 +808,4 @@ def reset

end

end
end