This repository was archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
This repository was archived by the owner on Jan 6, 2022. It is now read-only.
Deletion of EC2 Instances with attached Volumes fails #4
Copy link
Copy link
Open
Description
When not running in dry_run, deletion of ec2 volumes attached to a just deleted ec2 instance will result in a stacktrace:
ERROR Error while trying to delete resource
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/monocyte/__init__.py", line 109, in handle_service
specific_handler.delete(resource)
File "/usr/local/lib/python2.7/site-packages/monocyte/handler/ec2.py", line 103, in delete
connection.delete_volume(resource.wrapped.id, dry_run=False)
File "/usr/lib/python2.7/dist-packages/boto/ec2/connection.py", line 2333, in delete_volume
return self.get_status('DeleteVolume', params, verb='POST')
File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 1227, in get_status
raise self.ResponseError(response.status, response.reason, body)
EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>VolumeInUse</Code><Message>Volume vol-7ad7318d is currently attached to i-37d9a8f3</Message></Error></Errors><RequestID>83a2fd92-6bae-44fd-ac12-eb6172e1170a</Re
questID></Response>
Traceback (most recent call last):
File "/usr/local/bin/monocyte", line 38, in <module>
run()
File "/usr/local/bin/monocyte", line 34, in run
sys.exit(cli.main(arguments))
File "/usr/local/lib/python2.7/site-packages/monocyte/cli.py", line 67, in main
return monocyte.search_and_destroy_unwanted_resources()
File "/usr/local/lib/python2.7/site-packages/monocyte/__init__.py", line 91, in search_and_destroy_unwanted_resources
self.handle_service(specific_handler)
File "/usr/local/lib/python2.7/site-packages/monocyte/__init__.py", line 116, in handle_service
self.logger.exception("Error while trying to delete resource")
File "/usr/lib64/python2.7/logging/__init__.py", line 1198, in exception
self.error(msg, *args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1191, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1284, in _log
self.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1294, in handle
self.callHandlers(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1334, in callHandlers
hdlr.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 757, in handle
self.emit(record)
File "/usr/local/lib/python2.7/site-packages/cloudwatchlogs_logging/__init__.py", line 102, in emit
message = json.dumps(record_dict)
File "/usr/lib64/python2.7/json/__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <class 'boto.exception.EC2ResponseError'> is not JSON serializable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels