Skip to content

Commit

Permalink
Adding feature to remove the SQS queues
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed Aug 22, 2013
1 parent 8a95b3b commit 2ff73d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions aws/sqs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from core.region_connection import SQSConnection

def teardown_sqs():
conn = SQSConnection()

for queue in conn.get_all_queues(prefix='nimbostratus'):

# Empty the queue in order to remove it
for message in queue.get_messages():
queue.delete_message(message)

conn.delete_queue(queue)
6 changes: 5 additions & 1 deletion core/region_connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import boto.rds
import boto.iam
import boto.ec2
import boto.sqs

from config import REGION

Expand All @@ -12,4 +13,7 @@ def RDSConnection():
return boto.rds.connect_to_region(REGION)

def IAMConnection():
return boto.iam.connect_to_region('universal')
return boto.iam.connect_to_region('universal')

def SQSConnection():
return boto.sqs.connect_to_region(REGION)
2 changes: 2 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from aws.rds import spawn_rds, teardown_rds
from aws.iam import spawn_iam_user, teardown_iam_user
from aws.sqs import teardown_sqs

from core.log_handler import configure_logging

Expand All @@ -31,4 +32,5 @@ def teardown():
teardown_iam_user()

teardown_celery_backend()
teardown_sqs()

0 comments on commit 2ff73d7

Please sign in to comment.