def modify_dot_attribute(module, ec2, instance, device_name):
 delete_on_termination = module.params.get('delete_on_termination')
 changed = False
 try:
  instance.update()
  dot = instance.block_device_mapping[device_name].delete_on_termination
 except boto.exception.BotoServerError as e:
  module.fail_json(msg=('%s: %s' % (e.error_code, e.error_message)))
 if (delete_on_termination != dot):
  try:
   bdt = BlockDeviceType(delete_on_termination=delete_on_termination)
   bdm = BlockDeviceMapping()
   bdm[device_name] = bdt
   ec2.modify_instance_attribute(instance_id=instance.id, attribute='blockDeviceMapping', value=bdm)
   while (instance.block_device_mapping[device_name].delete_on_termination != delete_on_termination):
    time.sleep(3)
    instance.update()
   changed = True
  except boto.exception.BotoServerError as e:
   module.fail_json(msg=('%s: %s' % (e.error_code, e.error_message)))
 return changed

def modify_dot_attribute ( module , ec2 , instance , device_name ) : delete_on_termination = module . params . get ( 'delete_on_termination' ) changed = False try : instance . update ( ) dot = instance . block_device_mapping [ device_name ] . delete_on_termination except boto . exception . BotoServerError as e : module . fail_json ( msg = ( '%s: %s' % ( e . error_code , e . error_message ) ) ) if ( delete_on_termination != dot ) : try : bdt = BlockDeviceType ( delete_on_termination = delete_on_termination ) bdm = BlockDeviceMapping ( ) bdm [ device_name ] = bdt ec2 . modify_instance_attribute ( instance_id = instance . id , attribute = 'blockDeviceMapping' , value = bdm ) while ( instance . block_device_mapping [ device_name ] . delete_on_termination != delete_on_termination ) : time . sleep ( 3 ) instance . update ( ) changed = True except boto . exception . BotoServerError as e : module . fail_json ( msg = ( '%s: %s' % ( e . error_code , e . error_message ) ) ) return changed
modify delete_on_termination attribute .