scripts: Replace optparse with argparse.

This commit is contained in:
rht 2017-11-09 08:13:07 +01:00 committed by Tim Abbott
parent 5f6dbe6226
commit 54fb88f331
1 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@
import sys
import time
import optparse
import argparse
from collections import defaultdict
import os
import subprocess
@ -23,14 +23,14 @@ if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]"""
parser = optparse.OptionParser(usage=usage)
parser.add_option('--min-threshold',
dest='min_count',
type="int",
default=1,
action='store')
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('--min-threshold',
dest='min_count',
type=int,
default=1,
action='store')
(options, args) = parser.parse_args()
options = parser.parse_args()
output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'],
universal_newlines=True)