Index: bin/cq |
diff --git a/bin/cq b/bin/cq |
index 258002d56a0e0b167a5c8553a8b6542aec558a15..dd9b9144afc144e39087780f38b45ca7e716afb5 100755 |
--- a/bin/cq |
+++ b/bin/cq |
@@ -21,23 +21,25 @@ |
# IN THE SOFTWARE. |
# |
import getopt, sys |
+import boto.sqs |
from boto.sqs.connection import SQSConnection |
from boto.exception import SQSError |
def usage(): |
- print 'cq [-c] [-q queue_name] [-o output_file] [-t timeout]' |
+ print 'cq [-c] [-q queue_name] [-o output_file] [-t timeout] [-r region]' |
def main(): |
try: |
- opts, args = getopt.getopt(sys.argv[1:], 'hcq:o:t:', |
+ opts, args = getopt.getopt(sys.argv[1:], 'hcq:o:t:r:', |
['help', 'clear', 'queue', |
- 'output', 'timeout']) |
+ 'output', 'timeout', 'region']) |
except: |
usage() |
sys.exit(2) |
queue_name = '' |
output_file = '' |
timeout = 30 |
+ region = '' |
clear = False |
for o, a in opts: |
if o in ('-h', '--help'): |
@@ -51,7 +53,12 @@ def main(): |
clear = True |
if o in ('-t', '--timeout'): |
timeout = int(a) |
- c = SQSConnection() |
+ if o in ('-r', '--region'): |
+ region = a |
+ if region: |
+ c = boto.sqs.connect_to_region(region) |
+ else: |
+ c = SQSConnection() |
if queue_name: |
try: |
rs = [c.create_queue(queue_name)] |